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

Method onAnimateDataChange

packages/sanddance/src/viewer.ts:164–200  ·  view source on GitHub ↗
(dataChange: DataLayoutChange, waitingLabel: string, handlerLabel: string)

Source from the content-addressed store, hash-verified

162 }
163
164 private onAnimateDataChange(dataChange: DataLayoutChange, waitingLabel: string, handlerLabel: string) {
165 return new Promise<void>((resolve, reject) => {
166 let innerPromise: Promise<any>;
167 if (dataChange === DataLayoutChange.refine) {
168 const oldColorContext = this.colorContexts[this.currentColorContext];
169 innerPromise = new Promise<void>(innerResolve => {
170 this.renderNewLayout({}, {
171 preStage: (stage, deckProps) => {
172 finalizeLegend(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language);
173 this.overrideAxisLabels(stage);
174 applyColorMapToCubes([oldColorContext.colorMap], VegaDeckGl.util.getCubes(deckProps));
175 if (this.options.onStage) {
176 this.options.onStage(stage, deckProps);
177 }
178 },
179 }).then(() => {
180 //apply old legend
181 this.applyLegendColorContext(oldColorContext);
182 innerResolve();
183 });
184 });
185 } else {
186 innerPromise = this.renderNewLayout({}, {
187 preStage: (stage, deckProps) => {
188 finalizeLegend(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language);
189 this.overrideAxisLabels(stage);
190 if (this.options.onStage) {
191 this.options.onStage(stage, deckProps);
192 }
193 },
194 });
195 }
196 innerPromise.then(() => {
197 this.presenter.animationQueue(resolve, this.options.transitionDurations.position, { waitingLabel, handlerLabel, animationCanceled: reject });
198 });
199 });
200 }
201
202 private async onDataChanged(dataLayout: DataLayoutChange, filter?: Search) {
203 switch (dataLayout) {

Callers 2

filterMethod · 0.45
resetMethod · 0.45

Calls 6

renderNewLayoutMethod · 0.95
overrideAxisLabelsMethod · 0.95
finalizeLegendFunction · 0.90
applyColorMapToCubesFunction · 0.90
animationQueueMethod · 0.45

Tested by

no test coverage detected