• Public
  • Public/Protected
  • All

Class Resizable

Mixin that incorporates resize event handling. The mixin depends on the global window resize event and forwards any resize event to every existing instance of this class (global tracking).





  • Every instance of resizable is registered in the global list of resizable instances. The first instance, however, triggers the registration of the global window resize event listener.

    Returns Resizable



EVENT_IDENTIFIER: "resize" = "resize"

Event identifier for resize event (single point of definition).

Static Private eventSupported

eventSupported: boolean = false

Resize event availability (cached value).

Static Private instances

instances: Array<Resizable> = []

Array for referencing all instances of resizable.


Protected _resizeEventListener

  • _resizeEventListener(): void

Protected dispose

  • dispose(): void
  • Unregister this instance from the global list of resizable instances. On destruction of the last instance, the resize event handle is removed. Please note that destruction needs to be invoked explicitly.

    Returns void

Protected Abstract onResize

  • onResize(): void
  • This function is invoked when a resize event happened.

    Returns void

Static elementSize

  • elementSize(element: HTMLElement): GLsizei2 | undefined
  • Retrieves the native width and height of a given element in device pixel (size on screen in physical pixels). If the element is not found, or either window or its device pixel ratio are not defined, a default vec2 is returned. If the canvas size is not yet computed, i.e., not provided in px unit, undefined will be return.


    • element: HTMLElement

      DOM element to get the width and height in (native) pixel from.

    Returns GLsizei2 | undefined

    • Size of the element in native screen pixels. Undefined when size is not available in 'px'.

Static Protected resize

  • resize(): void
  • This function is called when the window is resized (and the event listener was successfully registered). The event is forwarded to each registered resizable object.

    Returns void