MCPcopy
hub / github.com/csev/py4e / estimateCoords

Function estimateCoords

tools/pythonauto/static/codemirrorepl/codemirror.js:1746–1752  ·  view source on GitHub ↗
(cm, pos)

Source from the content-addressed store, hash-verified

1744 // Used to cheaply estimate the coordinates for a position. Used for
1745 // intermediate scroll updates.
1746 function estimateCoords(cm, pos) {
1747 var left = 0, pos = clipPos(cm.doc, pos);
1748 if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;
1749 var lineObj = getLine(cm.doc, pos.line);
1750 var top = heightAtLine(lineObj) + paddingTop(cm.display);
1751 return {left: left, right: left, top: top, bottom: top + lineObj.height};
1752 }
1753
1754 // Positions returned by coordsChar contain some extra information.
1755 // xRel is the relative x position of the input coordinates compared

Callers 1

resolveScrollToPosFunction · 0.85

Calls 5

clipPosFunction · 0.70
charWidthFunction · 0.70
getLineFunction · 0.70
heightAtLineFunction · 0.70
paddingTopFunction · 0.70

Tested by

no test coverage detected