in modules/core/src/controllers/controller.js [148:196]
setProps(props) {
if ('onViewStateChange' in props) {
this.onViewStateChange = props.onViewStateChange;
}
if ('onStateChange' in props) {
this.onStateChange = props.onStateChange;
}
if ('makeViewport' in props) {
this.makeViewport = props.makeViewport;
}
this.controllerStateProps = props;
if ('eventManager' in props && this.eventManager !== props.eventManager) {
// EventManager has changed
this.eventManager = props.eventManager;
this._events = {};
this.toggleEvents(this._customEvents, true);
}
this.transitionManager.processViewStateChange(this.controllerStateProps);
// TODO - make sure these are not reset on every setProps
const {
scrollZoom = true,
dragPan = true,
dragRotate = true,
doubleClickZoom = true,
touchZoom = true,
touchRotate = false,
keyboard = true
} = props;
// Register/unregister events
const isInteractive = Boolean(this.onViewStateChange);
this.toggleEvents(EVENT_TYPES.WHEEL, isInteractive && scrollZoom);
this.toggleEvents(EVENT_TYPES.PAN, isInteractive && (dragPan || dragRotate));
this.toggleEvents(EVENT_TYPES.PINCH, isInteractive && (touchZoom || touchRotate));
this.toggleEvents(EVENT_TYPES.DOUBLE_TAP, isInteractive && doubleClickZoom);
this.toggleEvents(EVENT_TYPES.KEYBOARD, isInteractive && keyboard);
// Interaction toggles
this.scrollZoom = scrollZoom;
this.dragPan = dragPan;
this.dragRotate = dragRotate;
this.doubleClickZoom = doubleClickZoom;
this.touchZoom = touchZoom;
this.touchRotate = touchRotate;
this.keyboard = keyboard;
}