Class: RenderRoot
Experimental
Implements
Constructors
Constructor
new RenderRoot(container, options?): RenderRoot;Experimental
Parameters
| Parameter | Type |
|---|---|
container | HTMLElement |
options | RenderRootOptions |
Returns
RenderRoot
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
canvas | readonly | HTMLCanvasElement | Experimental The figure's canvas in the page. Under a shared renderer this is not renderer.domElement. |
container | readonly | HTMLElement | Experimental |
context | readonly | PrimitiveContext | Experimental Context handed to primitives. |
loop | readonly | RenderLoop | Experimental |
overlay | readonly | Viewport | null | Experimental Figure-level overlay (paper-space components), drawn after every other viewport. |
renderer | readonly | WebGLRenderer | Experimental |
resources | readonly | ResourceManager | Experimental |
shared | readonly | boolean | Experimental Whether the renderer (and its WebGL context) is shared with other roots. |
Accessors
canvasHeight
Get Signature
get canvasHeight(): number;Experimental
Returns
number
Experimental
Implementation of
canvasWidth
Get Signature
get canvasWidth(): number;Experimental
Returns
number
Experimental
Implementation of
capabilities
Get Signature
get capabilities(): GpuCapabilities;Experimental
The device's GPU limits: read when the root is created, updated after a context restore.
Returns
contextLost
Get Signature
get contextLost(): boolean;Experimental
Returns
boolean
destroyed
Get Signature
get destroyed(): boolean;Experimental
Returns
boolean
pixelRatio
Get Signature
get pixelRatio(): number;Experimental
Returns
number
Experimental
Implementation of
size
Get Signature
get size(): Readonly<ViewportSize>;Experimental
Canvas CSS size and pixel ratio (read-only, updated in place).
Returns
Readonly<ViewportSize>
viewports
Get Signature
get viewports(): readonly Viewport[];Experimental
Returns
readonly Viewport[]
Methods
activate()
activate(): void;Experimental
Point a shared renderer at this root (its pixel ratio) before drawing outside the frame, e.g. into a render target. Does nothing on a root with its own context.
Returns
void
addViewport()
addViewport(options?): Viewport;Experimental
Parameters
| Parameter | Type |
|---|---|
options | ViewportOptions |
Returns
destroy()
destroy(): void;Experimental
Dispose every viewport, primitive, GPU resource, listener, and the context itself.
Returns
void
flush()
flush(): void;Experimental
Render synchronously if a frame is pending.
Returns
void
invalidate()
invalidate(): void;Experimental
Schedule a frame (coalesced).
Returns
void
Implementation of
on()
on<K>(type, listener): () => void;Experimental
Type Parameters
| Type Parameter |
|---|
K extends keyof RenderRootEvents |
Parameters
| Parameter | Type |
|---|---|
type | K |
listener | (payload) => void |
Returns
() => void
removeViewport()
removeViewport(viewport, options?): void;Experimental
Remove a viewport. By default its primitives and scene contents are disposed.
Parameters
| Parameter | Type |
|---|---|
viewport | Viewport |
options | { dispose?: boolean; } |
options.dispose? | boolean |
Returns
void
renderNow()
renderNow(): void;Experimental
Render synchronously now, regardless of the dirty flag (e.g. for image export).
Returns
void
requestAnimation()
requestAnimation(): () => void;Experimental
Enter continuous rendering until the returned function is called (ref-counted).
Returns
() => void
resize()
resize(width, height): void;Experimental
Resize the canvas (CSS px). Called automatically when responsive.
Parameters
| Parameter | Type |
|---|---|
width | number |
height | number |
Returns
void
setBackground()
setBackground(background): void;Experimental
Parameters
| Parameter | Type |
|---|---|
background | RGBA | null |
Returns
void
setPixelRatio()
setPixelRatio(pixelRatio): void;Experimental
Override the pixel ratio (disables automatic DPR tracking only if passed at construction).
Parameters
| Parameter | Type |
|---|---|
pixelRatio | number |
Returns
void
viewportAt()
viewportAt(px, py): Viewport | null;Experimental
Topmost visible viewport under a container-space point (for hover routing).
Parameters
| Parameter | Type |
|---|---|
px | number |
py | number |
Returns
Viewport | null