Class RedGPUContextSizeManager

The RedGPUContextSizeManager class manages the size and scale of the RedGPUContext.

Constructors

Accessors

  • get parentDomRect(): DOMRect

    Retrieves the rectangular dimensions of the parent DOM element of the HTML canvas.

    Returns DOMRect

    The DOMRect object representing the dimensions of the parent element.

  • get pixelRectArray(): [number, number, number, number]

    현재 width, height, renderScale 기반 렌더링될 실제 pixel(정수)단위의 Rect를 배열로 반환

    Returns [number, number, number, number]

  • get pixelRectObject(): { height: number; width: number; x: number; y: number }

    현재 width, height, renderScale 기반 렌더링될 실제 pixel(정수)단위의 Rect를 객체로 반환

    Returns { height: number; width: number; x: number; y: number }

Methods

  • Sets the size of the element. If width and height are not provided, the current width and height values are used.

    Parameters

    • Optionalw: string | number = ...

      The new width of the element.

    • Optionalh: string | number = ...

      The new height of the element.

    Returns void

  • Calculates the size value based on the given rect object, key, and value. If the value contains a percentage sign (%), the method returns the calculated size value. If the value does not contain a percentage sign, the method returns the size value as is.

    Parameters

    • rect: { height: number; width: number; x: number; y: number }

      The rectangle object containing x, y, width, and height properties.

    • key: string

      The key corresponding to the property of the rect object that should be used for calculations.

    • value: string

      The value to calculate the size from. Can be a percentage with a % suffix or pixel value with a px suffix.

    Returns number

    • The calculated size value based on the given value and rect object.
  • Parameters

    • parentRect: ParentRect
    • key: string
    • value: string | number

    Returns number