(dataLayout, filter)
| 9406 | }); |
| 9407 | } |
| 9408 | onDataChanged(dataLayout, filter) { |
| 9409 | return __awaiter(this, void 0, void 0, function*() { |
| 9410 | switch(dataLayout){ |
| 9411 | case (0, _animator.DataLayoutChange).same: |
| 9412 | this.renderSameLayout(); |
| 9413 | break; |
| 9414 | case (0, _animator.DataLayoutChange).refine: |
| 9415 | { |
| 9416 | //save cube colors |
| 9417 | const oldColorContext = this.colorContexts[this.currentColorContext]; |
| 9418 | let colorMap; |
| 9419 | yield this.renderNewLayout({}, { |
| 9420 | preStage: (stage, deckProps)=>{ |
| 9421 | //save off the spec colors |
| 9422 | colorMap = (0, _colorCubes.colorMapFromCubes)(stage.cubeData); |
| 9423 | (0, _colorCubes.applyColorMapToCubes)([ |
| 9424 | oldColorContext.colorMap |
| 9425 | ], _vegaDeckGl.util.getCubes(deckProps)); |
| 9426 | this.preStage(stage, deckProps); |
| 9427 | }, |
| 9428 | onPresent: ()=>{ |
| 9429 | //save new legend |
| 9430 | const newColorContext = { |
| 9431 | colorMap, |
| 9432 | legend: _vegaDeckGl.util.clone(this.presenter.stage.legend), |
| 9433 | legendElement: this.presenter.getElement(_vegaDeckGl.PresenterElement.legend).children[0] |
| 9434 | }; |
| 9435 | //apply old legend |
| 9436 | this.applyLegendColorContext(oldColorContext); |
| 9437 | this.changeColorContexts([ |
| 9438 | oldColorContext, |
| 9439 | newColorContext |
| 9440 | ]); |
| 9441 | } |
| 9442 | }); |
| 9443 | //narrow the filter only if it is different |
| 9444 | if (!_searchExpression.compare(this.insight.filter, filter)) this.insight.filter = _searchExpression.narrow(this.insight.filter, filter); |
| 9445 | if (this.options.onDataFilter) this.options.onDataFilter(this.insight.filter, this._dataScope.currentData()); |
| 9446 | break; |
| 9447 | } |
| 9448 | case (0, _animator.DataLayoutChange).reset: |
| 9449 | { |
| 9450 | const colorContext = { |
| 9451 | colorMap: null, |
| 9452 | legend: null, |
| 9453 | legendElement: null |
| 9454 | }; |
| 9455 | this.changeColorContexts([ |
| 9456 | colorContext |
| 9457 | ]); |
| 9458 | yield this.renderNewLayout({}, { |
| 9459 | onPresent: ()=>{ |
| 9460 | (0, _colorCubes.populateColorContext)(colorContext, this.presenter); |
| 9461 | } |
| 9462 | }); |
| 9463 | delete this.insight.filter; |
| 9464 | if (this.options.onDataFilter) this.options.onDataFilter(null, null); |
| 9465 | break; |
no test coverage detected