Module: container

Provides access to the 3D canvas element and its container.

Summary

Methods

Detailed Description

Methods

client_to_canvas_coords(x, y, destopt) → {Vec2}

Convert client(e.clientX/e.clientY) CSS coordinates to CSS coordinates relative to the Canvas.
Parameters:
Name Type Attributes Default Description
x Number X client coordinate.
y Number Y client coordinate.
dest Vec2 <optional>
Float32Array(2) CSS coordinates relative to the Canvas.
Returns:
CSS coordinates relative to the Canvas.
Type
Vec2
Source:

force_offsets_updating()

Update canvas offsets on the next request.
Source:

get_canvas() → {HTMLElement}

Returns the 3D canvas element.
Returns:
Canvas element
Type
HTMLElement
Source:

get_canvas_hud() → {HTMLElement}

Returns the HUD element.
Returns:
Canvas hud element
Type
HTMLElement
Source:

get_container() → {HTMLElement}

Returns the HTML element which contains the 3D canvas.
Returns:
Canvas container element
Type
HTMLElement
Source:

insert_to_container(elem, stack_order)

Inserts the DOM element to the container.
Parameters:
Name Type Description
elem HTMLElement Inserted DOM element.
stack_order String Inserted DOM element stack order (one of "FIRST", "JUST_BEFORE_CANVAS", "JUST_AFTER_CANVAS", "LAST").
Source:

resize(width, height, update_canvas_cssopt)

Resize the rendering canvas.
Parameters:
Name Type Attributes Default Description
width Number New canvas width
height Number New canvas height
update_canvas_css Boolean <optional>
true Change canvas CSS width/height
Source:

resize_to_container(forceopt)

Fit canvas elements to match the size of container element.
Parameters:
Name Type Attributes Default Description
force Boolean <optional>
false Resize canvas element even in case of matching of canvas and container size.
Source:

set_canvas_offsets(left, top)

Set left/top offsets (relative to browser window) for the canvas. Can be useful in case of scrolling/DOM-manipulations, when the canvas position has been changed.
Parameters:
Name Type Description
left Number Left offset for the container
top Number Top offset for the container
Source:

update_canvas_offsets()

Update canvas left/top offsets (relative to browser window). Can be useful in case of scrolling/DOM-manipulations, when the canvas position has been changed.
Source: