MCPcopy Create free account
hub / github.com/plotly/plotly.js / getClosestCorner

Function getClosestCorner

src/traces/scatter/line_points.js:241–248  ·  view source on GitHub ↗
(pt1, pt2)

Source from the content-addressed store, hash-verified

239 // a segment pt1->pt2 entirely outside the nearby region:
240 // find the corner it gets closest to touching
241 function getClosestCorner(pt1, pt2) {
242 var dx = pt2[0] - pt1[0];
243 var m = (pt2[1] - pt1[1]) / dx;
244 var b = (pt1[1] * pt2[0] - pt2[1] * pt1[0]) / dx;
245
246 if(b > 0) return [m > 0 ? xEdge0 : xEdge1, yEdge1];
247 else return [m > 0 ? xEdge1 : xEdge0, yEdge0];
248 }
249
250 function updateEdge(pt) {
251 var x = pt[0];

Callers 1

addPtFunction · 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…