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

Function updateEdge

src/traces/scatter/line_points.js:250–269  ·  view source on GitHub ↗
(pt)

Source from the content-addressed store, hash-verified

248 }
249
250 function updateEdge(pt) {
251 var x = pt[0];
252 var y = pt[1];
253 var xSame = x === pts[pti - 1][0];
254 var ySame = y === pts[pti - 1][1];
255 // duplicate point?
256 if(xSame && ySame) return;
257 if(pti > 1) {
258 // backtracking along an edge?
259 var xSame2 = x === pts[pti - 2][0];
260 var ySame2 = y === pts[pti - 2][1];
261 if(xSame && (x === xEdge0 || x === xEdge1) && xSame2) {
262 if(ySame2) pti--; // backtracking exactly - drop prev pt and don't add
263 else pts[pti - 1] = pt; // not exact: replace the prev pt
264 } else if(ySame && (y === yEdge0 || y === yEdge1) && ySame2) {
265 if(xSame2) pti--;
266 else pts[pti - 1] = pt;
267 } else pts[pti++] = pt;
268 } else pts[pti++] = pt;
269 }
270
271 function updateEdgesForReentry(pt) {
272 // if we're outside the nearby region and going back in,

Callers 3

updateEdgesForReentryFunction · 0.85
addPtFunction · 0.85
line_points.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…