MCPcopy Index your code
hub / github.com/microsoft/SandDance / renderSameLayout

Method renderSameLayout

packages/sanddance/src/viewer.ts:353–388  ·  view source on GitHub ↗

* Render the same layout with new options. * @param newViewerOptions New options object.

(newViewerOptions?: Partial<ViewerOptions>)

Source from the content-addressed store, hash-verified

351 * @param newViewerOptions New options object.
352 */
353 renderSameLayout(newViewerOptions?: Partial<ViewerOptions>) {
354 const colorContext = this.colorContexts[this.currentColorContext];
355 const clonedCubes = this.presenter.getCubeData().map(cube => {
356 return { ...cube };
357 });
358
359 this.applyLegendColorContext(colorContext);
360
361 let { axes, textData } = this.presenter.stage;
362 let recoloredAxes: Partial<VegaDeckGl.types.Stage>;
363
364 if (newViewerOptions) {
365 if (newViewerOptions.colors) {
366 recoloredAxes = recolorAxes(this.presenter.stage, this._lastColorOptions, newViewerOptions.colors);
367 this._lastColorOptions = VegaDeckGl.util.clone(newViewerOptions.colors);
368 axes = recoloredAxes.axes || axes;
369 textData = recoloredAxes.textData || textData;
370 }
371 this.options = VegaDeckGl.util.deepMerge(this.options, newViewerOptions as ViewerOptions);
372 }
373
374 const colorMaps: ColorMap[] = [colorContext.colorMap];
375 let colorMethod: ColorMethod;
376 const hasSelectedData = this._dataScope.hasSelectedData();
377 const hasActive = !!this._dataScope.active;
378 if (hasSelectedData || hasActive) {
379 const selectedColorMap = getSelectedColorMap(this._dataScope.currentData(), hasSelectedData, hasActive, this.options);
380 colorMaps.push(selectedColorMap);
381 colorMethod = this.options.colors.unselectedColorMethod;
382 }
383
384 applyColorMapToCubes(colorMaps, clonedCubes, colorMethod);
385
386 const stage: Partial<VegaDeckGl.types.Stage> = { cubeData: clonedCubes, axes, textData };
387 this.vegaViewGl.presenter.rePresent(stage, this.createConfig().presenterConfig);
388 }
389
390 private getView(view: View) {
391 if (view === undefined) {

Callers 5

constructorMethod · 0.95
onDataChangedMethod · 0.95
changeThemeMethod · 0.45
manageColorToolbarMethod · 0.45
changeColorSchemeMethod · 0.45

Calls 10

createConfigMethod · 0.95
recolorAxesFunction · 0.90
getSelectedColorMapFunction · 0.90
applyColorMapToCubesFunction · 0.90
getCubeDataMethod · 0.45
cloneMethod · 0.45
hasSelectedDataMethod · 0.45
currentDataMethod · 0.45
rePresentMethod · 0.45

Tested by

no test coverage detected