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

Method onDataChanged

docs/app/js/sanddance-app.js:9408–9473  ·  view source on GitHub ↗
(dataLayout, filter)

Source from the content-addressed store, hash-verified

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;

Callers 6

selectMethod · 0.45
deselectMethod · 0.45
filterMethod · 0.45
resetMethod · 0.45
activateMethod · 0.45
deactivateMethod · 0.45

Calls 10

renderSameLayoutMethod · 0.95
renderNewLayoutMethod · 0.95
preStageMethod · 0.95
changeColorContextsMethod · 0.95
getSelectionMethod · 0.95
__awaiterFunction · 0.85
cloneMethod · 0.45
getElementMethod · 0.45
currentDataMethod · 0.45

Tested by

no test coverage detected