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

Function coerceSelectionsCache

src/components/selections/select.js:678–710  ·  view source on GitHub ↗
(evt, gd, dragOptions)

Source from the content-addressed store, hash-verified

676}
677
678function coerceSelectionsCache(evt, gd, dragOptions) {
679 var fullLayout = gd._fullLayout;
680 var plotinfo = dragOptions.plotinfo;
681 var dragmode = dragOptions.dragmode;
682
683 var selectingOnSameSubplot = (
684 fullLayout._lastSelectedSubplot &&
685 fullLayout._lastSelectedSubplot === plotinfo.id
686 );
687
688 var hasModifierKey = (evt.shiftKey || evt.altKey) &&
689 !(drawMode(dragmode) && openMode(dragmode));
690
691 if(
692 selectingOnSameSubplot &&
693 hasModifierKey &&
694 plotinfo.selection &&
695 plotinfo.selection.selectionDefs &&
696 !dragOptions.selectionDefs
697 ) {
698 // take over selection definitions from prev mode, if any
699 dragOptions.selectionDefs = plotinfo.selection.selectionDefs;
700 dragOptions.mergedPolygons = plotinfo.selection.mergedPolygons;
701 } else if(!hasModifierKey || !plotinfo.selection) {
702 clearSelectionsCache(dragOptions);
703 }
704
705 // clear selection outline when selecting a different subplot
706 if(!selectingOnSameSubplot) {
707 clearOutline(gd);
708 fullLayout._lastSelectedSubplot = plotinfo.id;
709 }
710}
711
712function hasActiveShape(gd) {
713 return gd._fullLayout._activeShapeIndex >= 0;

Callers 2

prepSelectFunction · 0.85
selectOnClickFunction · 0.85

Calls 2

clearSelectionsCacheFunction · 0.85
clearOutlineFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…