Skip to content

Interface: View3DProjector ​

Experimental

See the module comment.

Implements ​

Accessors ​

angles ​

Get Signature ​

ts
get angles(): View3DAngles;

Experimental

Returns ​

View3DAngles


camera ​

Get Signature ​

ts
get camera(): OrthographicCamera | PerspectiveCamera;

Experimental

The camera the viewport draws with.

Returns ​

OrthographicCamera | PerspectiveCamera

Implementation of ​

ts
ViewportProjector.camera;

view ​

Get Signature ​

ts
get view(): View3DCamera | null;

Experimental

The current camera math (null before the first layout).

Returns ​

View3DCamera | null


viewport ​

Get Signature ​

ts
get viewport(): Viewport | null;

Experimental

The viewport drawn in 2.5D (null when detached).

Returns ​

Viewport | null

Methods ​

attach() ​

ts
attach(viewport): void;

Experimental

Draw viewport in 2.5D (see the module comment).

Parameters ​

ParameterType
viewportViewport

Returns ​

void


detach() ​

ts
detach(): void;

Experimental

Draw the viewport flat again: its camera, scissor, background and materials as before.

Returns ​

void


dispose() ​

ts
dispose(): void;

Experimental

Free the plane (after detach).

Returns ​

void


layout() ​

ts
layout(viewport): void;

Experimental

Recompute the camera for the viewport's rect and render area (called by layout()).

Parameters ​

ParameterType
viewportViewport

Returns ​

void

Implementation of ​

ts
ViewportProjector.layout;

project() ​

ts
project(
   x,
   y,
   z?
): [number, number];

Experimental

A plot-plane point (container px), raised by z px toward the viewer, on screen.

Parameters ​

ParameterTypeDefault value
xnumberundefined
ynumberundefined
znumber0

Returns ​

[number, number]

Implementation of ​

ts
ViewportProjector.project;

setAngles() ​

ts
setAngles(angles): void;

Experimental

Change the angles (a drag, a transition frame): recomputes the camera; request a frame.

Parameters ​

ParameterType
anglesView3DAngles

Returns ​

void


takeBackground() ​

ts
takeBackground(): void;

Experimental

Paint the viewport's background (e.g. set again by the chart for plot_bgcolor) with the plot-area quad, and clear it from the viewport. Call after anything that may set it.

Returns ​

void


unproject() ​

ts
unproject(x, y): [number, number];

Experimental

Screen point → the plot-plane point under it (on extruded geometry: the point below it).

Parameters ​

ParameterType
xnumber
ynumber

Returns ​

[number, number]

Implementation of ​

ts
ViewportProjector.unproject;

Released under the MIT License.