MCPcopy
hub / github.com/DHTMLX/gantt / estimateCoords

Function estimateCoords

samples/common/codehighlight/codemirror.js:2679–2686  ·  view source on GitHub ↗
(cm, pos)

Source from the content-addressed store, hash-verified

2677 // Used to cheaply estimate the coordinates for a position. Used for
2678 // intermediate scroll updates.
2679 function estimateCoords(cm, pos) {
2680 var left = 0;
2681 pos = clipPos(cm.doc, pos);
2682 if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }
2683 var lineObj = getLine(cm.doc, pos.line);
2684 var top = heightAtLine(lineObj) + paddingTop(cm.display);
2685 return {left: left, right: left, top: top, bottom: top + lineObj.height}
2686 }
2687
2688 // Positions returned by coordsChar contain some extra information.
2689 // xRel is the relative x position of the input coordinates compared

Callers 1

resolveScrollToPosFunction · 0.85

Calls 5

clipPosFunction · 0.85
charWidthFunction · 0.85
getLineFunction · 0.85
heightAtLineFunction · 0.85
paddingTopFunction · 0.85

Tested by

no test coverage detected