OrthographicController
July 26, 2021 ยท View on GitHub
Inherits from Base Controller.
The OrthographicController class can be passed to either the Deck class's controller prop or a View class's controller prop to specify that viewport interaction should be enabled.
OrthographicController is the default controller for OrthographicView.
Usage
Use with the default view:
import {Deck, OrthographicView} from '@deck.gl/core';
new Deck({
views: new OrthographicView(),
controller: {scrollZoom: false, inertia: true},
initialViewState: viewState
});
is equivalent to:
import {Deck, OrthographicView} from '@deck.gl/core';
new Deck({
views: new OrthographicView({
controller: {scrollZoom: false, inertia: true}
}),
initialViewState: viewState
})
Options
Supports all Controller options with the following default behavior:
dragPan: default'pan'(drag to pan)dragRotate: not effective, this view cannot be rotatedtouchRotate: not effective, this view cannot be rotatedkeyboard: arrow keys to pan, +/- to zoom
Custom OrthographicController
You can further customize the OrthographicController's behavior by extending the class:
import {Deck, OrthographicView, OrthographicController} from '@deck.gl/core';
class MyOrthographicController extends OrthographicController {
handleEvent(event) {
if (event.type === 'pan') {
// do something
} else {
super.handleEvent(event);
}
}
}
new Deck({
views: new OrthographicView(),
controller: {type: MyOrthographicController},
initialViewState: viewState
})
See the Controller class documentation for the methods that you can use and/or override.