MCPcopy Create free account
hub / github.com/microsoft/SandDance / wrapper

Function wrapper

docs/app/js/sanddance-app.js:8380–8415  ·  view source on GitHub ↗
(props1)

Source from the content-addressed store, hash-verified

8378 //dynamic superclass lets us create a subclass at execution phase instead of declaration phase.
8379 //This allows us to retrieve Deck from either UMD or ES6 consumers of this class.
8380 function wrapper(props1) {
8381 /**
8382 * @params container (Element) - DOM element to add deck.gl canvas to
8383 * @params controller (Object) - Controller class. Leave empty for auto detection
8384 */ class DeckGLInternal extends (0, _base.base).deck.Deck {
8385 constructor(props){
8386 if (typeof document === "undefined") // Not browser
8387 throw Error("Deck can only be used in the browser");
8388 const { deckCanvas } = createCanvas(props);
8389 const viewState = props.initialViewState || props.viewState || {};
8390 super(Object.assign({}, props, {
8391 width: "100%",
8392 height: "100%",
8393 canvas: deckCanvas,
8394 controller: OrbitControllerClass,
8395 initialViewState: viewState
8396 }));
8397 // Callback for the controller
8398 this._updateViewState = (params)=>{
8399 if (this.onViewStateChange) this.onViewStateChange(params);
8400 };
8401 }
8402 setProps(props) {
8403 // this._updateViewState must be bound to `this`
8404 // but we don't have access to the current instance before calling super().
8405 if ("onViewStateChange" in props && this._updateViewState) {
8406 // This is called at least once at _onRendererInitialized
8407 this.onViewStateChange = props.onViewStateChange;
8408 props.onViewStateChange = this._updateViewState;
8409 }
8410 super.setProps(props);
8411 }
8412 }
8413 const instance = new DeckGLInternal(props1);
8414 return instance;
8415 }
8416 return {
8417 OrbitControllerClass,
8418 DeckGL_Class: wrapper

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected