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

Function reselect

src/components/selections/select.js:1100–1282  ·  view source on GitHub ↗
(gd, mayEmitSelected, selectionTesters, searchTraces, dragOptions)

Source from the content-addressed store, hash-verified

1098}
1099
1100function reselect(gd, mayEmitSelected, selectionTesters, searchTraces, dragOptions) {
1101 var hadSearchTraces = !!searchTraces;
1102 var plotinfo, xRef, yRef;
1103 if(dragOptions) {
1104 plotinfo = dragOptions.plotinfo;
1105 xRef = dragOptions.xaxes[0]._id;
1106 yRef = dragOptions.yaxes[0]._id;
1107 }
1108
1109 var allSelections = [];
1110 var allSearchTraces = [];
1111
1112 // select layout.selection polygons
1113 var layoutPolygons = getLayoutPolygons(gd);
1114
1115 // add draft outline polygons to layoutPolygons
1116 var fullLayout = gd._fullLayout;
1117 if(plotinfo) {
1118 var zoomLayer = fullLayout._zoomlayer;
1119 var mode = fullLayout.dragmode;
1120 var isDrawMode = drawMode(mode);
1121 var isSelectMode = selectMode(mode);
1122 if(isDrawMode || isSelectMode) {
1123 var xaxis = getFromId(gd, xRef, 'x');
1124 var yaxis = getFromId(gd, yRef, 'y');
1125 if(xaxis && yaxis) {
1126 var outlines = zoomLayer.selectAll('.select-outline-' + plotinfo.id);
1127 if(outlines && gd._fullLayout._outlining) {
1128 if(outlines.length) {
1129 var e = outlines[0][0]; // pick first
1130 var d = e.getAttribute('d');
1131 var outlinePolys = readPaths(d, gd, plotinfo);
1132
1133 var draftPolygons = [];
1134 for(var u = 0; u < outlinePolys.length; u++) {
1135 var p = outlinePolys[u];
1136 var polygon = [];
1137 for(var t = 0; t < p.length; t++) {
1138 polygon.push([
1139 convert(xaxis, p[t][1]),
1140 convert(yaxis, p[t][2])
1141 ]);
1142 }
1143
1144 polygon.xref = xRef;
1145 polygon.yref = yRef;
1146 polygon.subtract = getSubtract(polygon, draftPolygons);
1147
1148 draftPolygons.push(polygon);
1149 }
1150
1151 layoutPolygons = layoutPolygons.concat(draftPolygons);
1152 }
1153 }
1154 }
1155 }
1156 }
1157

Callers 1

prepSelectFunction · 0.85

Calls 15

getLayoutPolygonsFunction · 0.85
getSubtractFunction · 0.85
epmtySplomSelectionBatchFunction · 0.85
addTesterFunction · 0.85
determineSearchTracesFunction · 0.85
_doSelectFunction · 0.85
updateSelectedStateFunction · 0.85
castMultiPolygonFunction · 0.85
makeFillRangeItemsFunction · 0.85
fillRangeItemsFunction · 0.85
emitSelectedFunction · 0.85
subplotSelectedFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…