OrthographicView
The OrthographicView class is a subclass of View that creates a top-down view of the XY plane. It is usually used for rendering 2D charts in non-geospatial use cases.
It's recommended that you read the Views and Projections guide before using this class.
Constructor
import {OrthographicView} from '@deck.gl/core';
const view = new OrthographicView({id, ...});
OrthographicView takes the same parameters as the View superclass constructor, plus the following:
flipY (boolean)
Whether to use top-left coordinates (true) or bottom-left coordinates (false). Default true.
near (number, optional)
Distance of near clipping plane. Default 0.1.
far (number, optional)
Distance of far clipping plane. Default 1000.
View State
To render, OrthographicView needs to be used together with a viewState with the following parameters:
target(number[3], optional) - The world position at the center of the viewport. Default[0, 0, 0].zoom(number, optional) - The zoom level of the viewport.zoom: 0maps one unit distance to one pixel on screen, and increasingzoomby1scales the same object to twice as large. To apply independent zoom levels to the X and Y axes, usezoomXandzoomY. Default0.zoomX(number, optional) - The zoom level along X axis. Overrideszoomif supplied.zoomY(number, optional) - The zoom level along Y axis. Overrideszoomif supplied.minZoom(number, optional) - The min zoom level of the viewport. Default-Infinity.maxZoom(number, optional) - The max zoom level of the viewport. DefaultInfinity.minZoomX(number, optional) - The min zoom level of the viewport on X axis. DefaultminZoom.maxZoomX(number, optional) - The max zoom level of the viewport on X axis. DefaultmaxZoom.minZoomY(number, optional) - The min zoom level of the viewport on Y axis. DefaultminZoom.maxZoomY(number, optional) - The max zoom level of the viewport on Y axis. DefaultmaxZoom.
Controller
By default, OrthographicView uses the OrthographicController to handle interactivity. To enable the controller, use:
const view = new OrthographicView({id: '2d-scene', controller: true});
Visit the OrthographicController documentation for a full list of supported options.
Remarks
Common size resolution
This section describes how geometry size (e.g. scatterplot radius, path width, text size) of common units is resolved in OrthographicView.
When a uniform zoom is used, like all other view types, the zoom view state is used to project both position and size.
When the X and Y axes zoom independently, it becomes ambiguous whether size should follow X or Y. By default, size is scaled to Math.min(zoomX, zoomY), to provide visual stability. You may override this behavior by supplying a zoom value. While zoom is shadowed by zoomX and zoomY during position projection, it will be used to project sizes.