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

Function getABAEdgeIntersections

src/traces/scatter/line_points.js:205–229  ·  view source on GitHub ↗
(dim, limit0, limit1)

Source from the content-addressed store, hash-verified

203 // out BEYOND the clipping rect, by a maximum of a factor of 2, so that
204 // the midpoint line is drawn in the right place
205 function getABAEdgeIntersections(dim, limit0, limit1) {
206 return function(pt1, pt2) {
207 var ptInt1 = onlyConstrainedPoint(pt1);
208 var ptInt2 = onlyConstrainedPoint(pt2);
209
210 var out = [];
211 if(ptInt1 && ptInt2 && sameEdge(ptInt1, ptInt2)) return out;
212
213 if(ptInt1) out.push(ptInt1);
214 if(ptInt2) out.push(ptInt2);
215
216 var midShift = 2 * Lib.constrain((pt1[dim] + pt2[dim]) / 2, limit0, limit1) -
217 ((ptInt1 || pt1)[dim] + (ptInt2 || pt2)[dim]);
218 if(midShift) {
219 var ptToAlter;
220 if(ptInt1 && ptInt2) {
221 ptToAlter = (midShift > 0 === ptInt1[dim] > ptInt2[dim]) ? ptInt1 : ptInt2;
222 } else ptToAlter = ptInt1 || ptInt2;
223
224 ptToAlter[dim] += midShift;
225 }
226
227 return out;
228 };
229 }
230
231 var getEdgeIntersections;
232 if(shape === 'linear' || shape === 'spline') {

Callers 1

line_points.jsFile · 0.85

Calls 2

onlyConstrainedPointFunction · 0.85
sameEdgeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…