* Render the same layout with new options. * @param newViewerOptions New options object.
(newViewerOptions?: Partial<ViewerOptions>)
| 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) { |
no test coverage detected