MCPcopy Index your code
hub / github.com/plotly/plotly.js / clearSelectionsCache

Function clearSelectionsCache

src/components/selections/select.js:720–777  ·  view source on GitHub ↗
(dragOptions, immediateSelect)

Source from the content-addressed store, hash-verified

718}
719
720function clearSelectionsCache(dragOptions, immediateSelect) {
721 var dragmode = dragOptions.dragmode;
722 var plotinfo = dragOptions.plotinfo;
723
724 var gd = dragOptions.gd;
725 if(hasActiveShape(gd)) {
726 gd._fullLayout._deactivateShape(gd);
727 }
728 if(hasActiveSelection(gd)) {
729 gd._fullLayout._deactivateSelection(gd);
730 }
731
732 var fullLayout = gd._fullLayout;
733 var zoomLayer = fullLayout._zoomlayer;
734
735 var isDrawMode = drawMode(dragmode);
736 var isSelectMode = selectMode(dragmode);
737
738 if(isDrawMode || isSelectMode) {
739 var outlines = zoomLayer.selectAll('.select-outline-' + plotinfo.id);
740 if(outlines && gd._fullLayout._outlining) {
741 // add shape
742 var shapes;
743 if(isDrawMode) {
744 shapes = newShapes(outlines, dragOptions);
745 }
746 if(shapes) {
747 Registry.call('_guiRelayout', gd, {
748 shapes: shapes
749 });
750 }
751
752 // add selection
753 var selections;
754 if(
755 isSelectMode &&
756 !hasSubplot(dragOptions) // only allow cartesian - no maps for now
757 ) {
758 selections = newSelections(outlines, dragOptions);
759 }
760 if(selections) {
761 gd._fullLayout._noEmitSelectedAtStart = true;
762
763 Registry.call('_guiRelayout', gd, {
764 selections: selections
765 }).then(function() {
766 if(immediateSelect) { activateLastSelection(gd); }
767 });
768 }
769
770 gd._fullLayout._outlining = false;
771 }
772 }
773
774 plotinfo.selection = {};
775 plotinfo.selection.selectionDefs = dragOptions.selectionDefs = [];
776 plotinfo.selection.mergedPolygons = dragOptions.mergedPolygons = [];
777}

Callers 6

prepSelectFunction · 0.85
selectOnClickFunction · 0.85
coerceSelectionsCacheFunction · 0.85
mapbox.jsFile · 0.85
map.jsFile · 0.85
ternary.jsFile · 0.85

Calls 5

hasActiveShapeFunction · 0.85
hasActiveSelectionFunction · 0.85
newShapesFunction · 0.85
hasSubplotFunction · 0.85
activateLastSelectionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…