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

Method onCubeClick

packages/sanddance/src/viewer.ts:580–606  ·  view source on GitHub ↗
(e: MouseEvent | PointerEvent | TouchEvent, cube: VegaDeckGl.types.Cube)

Source from the content-addressed store, hash-verified

578 }
579
580 private onCubeClick(e: MouseEvent | PointerEvent | TouchEvent, cube: VegaDeckGl.types.Cube) {
581 this.options.onCubeClick && this.options.onCubeClick(e, cube);
582 const hasSelectedData = this._dataScope.hasSelectedData();
583 if (hasSelectedData && this._dataScope.selection.included.length > 1) {
584 //if active is within selection, keep the selection and activate the one.
585 const indexWithinSelection = this._dataScope.ordinalIndexWithinSelection(cube.ordinal);
586 if (indexWithinSelection.index >= 0) {
587 this.activate(indexWithinSelection.datum);
588 this._details.populate(this._dataScope.selection, indexWithinSelection.index);
589 if (this.options.onSelectionChanged) {
590 const sel = this.getSelection();
591 this.options.onSelectionChanged(sel.search, indexWithinSelection.index, sel.selectedData);
592 }
593 return;
594 }
595 }
596 if (hasSelectedData && this._dataScope.selection.included.length === 1 && this._dataScope.selection.included[0][GL_ORDINAL] === cube.ordinal) {
597 this.deselect();
598 return;
599 }
600 const search: SearchExpression = {
601 name: GL_ORDINAL,
602 operator: '==',
603 value: cube.ordinal,
604 };
605 this.select(search);
606 }
607
608 private onCubeHover(e: MouseEvent | PointerEvent | TouchEvent, cube: VegaDeckGl.types.Cube) {
609 if (this._tooltip) {

Callers 1

newCubeLayerFunction · 0.45

Calls 7

activateMethod · 0.95
getSelectionMethod · 0.95
deselectMethod · 0.95
selectMethod · 0.95
hasSelectedDataMethod · 0.45
populateMethod · 0.45

Tested by

no test coverage detected