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

Function crossesViewport

src/traces/scatter/line_points.js:89–100  ·  view source on GitHub ↗
(xFrac0, yFrac0, xFrac1, yFrac1)

Source from the content-addressed store, hash-verified

87 }
88
89 function crossesViewport(xFrac0, yFrac0, xFrac1, yFrac1) {
90 var dx = xFrac1 - xFrac0;
91 var dy = yFrac1 - yFrac0;
92 var dx0 = 0.5 - xFrac0;
93 var dy0 = 0.5 - yFrac0;
94 var norm2 = dx * dx + dy * dy;
95 var dot = dx * dx0 + dy * dy0;
96 if(dot > 0 && dot < norm2) {
97 var cross = dx0 * dy - dy0 * dx;
98 if(cross * cross < norm2) return true;
99 }
100 }
101
102 var latestXFrac, latestYFrac;
103 // if we're off-screen, increase tolerance over baseTolerance

Callers 1

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