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

Function getTolerance

src/traces/scatter/line_points.js:104–120  ·  view source on GitHub ↗
(pt, nextPt)

Source from the content-addressed store, hash-verified

102 var latestXFrac, latestYFrac;
103 // if we're off-screen, increase tolerance over baseTolerance
104 function getTolerance(pt, nextPt) {
105 var xFrac = pt[0] / xLen;
106 var yFrac = pt[1] / yLen;
107 var offScreenFraction = Math.max(0, -xFrac, xFrac - 1, -yFrac, yFrac - 1);
108 if(offScreenFraction && (latestXFrac !== undefined) &&
109 crossesViewport(xFrac, yFrac, latestXFrac, latestYFrac)
110 ) {
111 offScreenFraction = 0;
112 }
113 if(offScreenFraction && nextPt &&
114 crossesViewport(xFrac, yFrac, nextPt[0] / xLen, nextPt[1] / yLen)
115 ) {
116 offScreenFraction = 0;
117 }
118
119 return (1 + constants.toleranceGrowth * offScreenFraction) * baseTolerance;
120 }
121
122 function ptDist(pt1, pt2) {
123 var dx = pt1[0] - pt2[0];

Callers 1

line_points.jsFile · 0.85

Calls 1

crossesViewportFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…