MCPcopy
hub / github.com/nwutils/nw-sample-apps / localCoords

Function localCoords

mini-code-edit/cm/lib/codemirror.js:1595–1604  ·  view source on GitHub ↗
(pos, inLineWrap)

Source from the content-addressed store, hash-verified

1593 return {top: top, left: left};
1594 }
1595 function localCoords(pos, inLineWrap) {
1596 var x, lh = textHeight(), y = lh * (heightAtLine(doc, pos.line) - (inLineWrap ? displayOffset : 0));
1597 if (pos.ch == 0) x = 0;
1598 else {
1599 var sp = measureLine(getLine(pos.line), pos.ch);
1600 x = sp.left;
1601 if (options.lineWrapping) y += Math.max(0, sp.top);
1602 }
1603 return {x: x, y: y, yBot: y + lh};
1604 }
1605 // Coords must be lineSpace-local
1606 function coordsChar(x, y) {
1607 if (y < 0) y = 0;

Callers 5

CodeMirrorFunction · 0.85
scrollCursorIntoViewFunction · 0.85
updateSelectionFunction · 0.85
moveVFunction · 0.85
pageCoordsFunction · 0.85

Calls 4

textHeightFunction · 0.85
heightAtLineFunction · 0.85
measureLineFunction · 0.85
getLineFunction · 0.85

Tested by

no test coverage detected