MCPcopy
hub / github.com/microsoft/SandDance / present

Method present

packages/vega-deck.gl/src/presenter.ts:155–231  ·  view source on GitHub ↗

* Present the Vega Scene, or Stage object using Deck.gl. * @param sceneOrStage Vega Scene object, or Stage object containing chart layout info. * @param height Height of the rendering area. * @param width Width of the rendering area. * @param config Optional presentation configu

(sceneOrStage: Scene3d | Stage, height: number, width: number, config?: PresenterConfig)

Source from the content-addressed store, hash-verified

153 * @param config Optional presentation configuration object.
154 */
155 present(sceneOrStage: Scene3d | Stage, height: number, width: number, config?: PresenterConfig) {
156 this.animationCancel();
157 const scene = sceneOrStage as Scene3d;
158 let stage: Stage;
159 const options: MarkStagerOptions = {
160 maxOrdinal: 0,
161 currAxis: null,
162 defaultCubeColor: this.style.defaultCubeColor,
163 assignCubeOrdinal: config?.onSceneRectAssignCubeOrdinal || (() => options.maxOrdinal++),
164 zAxisZindex: config?.zAxisZindex,
165 };
166 //determine if this is a vega scene
167 if (scene.marktype) {
168 stage = createStage(scene.view);
169 sceneToStage(options, stage, scene);
170 } else {
171 stage = sceneOrStage as Stage;
172 }
173 if (!this.deckgl) {
174 const classes = createDeckGLClassesForPresenter({
175 doubleClickHandler: () => {
176 this.homeCamera();
177 },
178 });
179 this.OrbitControllerClass = classes.OrbitControllerClass;
180
181 const initialViewState = targetViewState(height, width, stage.view);
182
183 let glOptions: WebGLContextAttributes;
184 if (config && config.preserveDrawingBuffer) {
185 glOptions = { preserveDrawingBuffer: true };
186 }
187
188 const deckProps: Partial<DeckGLInternalProps> = {
189 glOptions,
190 height: null,
191 width: null,
192 effects: lightingEffects(),
193 layers: [],
194 onClick: config && config.onLayerClick,
195 views: [new base.deck.OrbitView({ controller: base.deck.OrbitController })],
196 initialViewState,
197 container: this.getElement(PresenterElement.gl) as HTMLCanvasElement,
198 getCursor: (interactiveState: InteractiveStateVegaDeckGL) => {
199 if (interactiveState.onText || interactiveState.onAxisSelection) {
200 return 'pointer';
201 } else if (interactiveState.onCube) {
202 return 'default';
203 } else {
204 return 'grab';
205 }
206 },
207 };
208 if (stage.backgroundColor) {
209 deckProps.style = { 'background-color': colorToString(stage.backgroundColor) };
210 }
211 this.deckgl = new classes.DeckGL_Class(deckProps);
212 }

Callers 3

cubeTest.tsFile · 0.45
_renderMethod · 0.45
cubeTest.tsFile · 0.45

Calls 15

animationCancelMethod · 0.95
homeCameraMethod · 0.95
getElementMethod · 0.95
setDeckPropsMethod · 0.95
createStageFunction · 0.90
sceneToStageFunction · 0.90
targetViewStateFunction · 0.90
lightingEffectsFunction · 0.90
colorToStringFunction · 0.90
patchCubeArrayFunction · 0.90
LegendViewFunction · 0.90

Tested by

no test coverage detected