MCPcopy Create free account
hub / github.com/TruthHun/BookStack / heightAtLine

Function heightAtLine

static/editor.md/lib/codemirror/lib/codemirror.js:7607–7624  ·  view source on GitHub ↗
(lineObj)

Source from the content-addressed store, hash-verified

7605
7606 // Find the height above the given line.
7607 function heightAtLine(lineObj) {
7608 lineObj = visualLine(lineObj);
7609
7610 var h = 0, chunk = lineObj.parent;
7611 for (var i = 0; i < chunk.lines.length; ++i) {
7612 var line = chunk.lines[i];
7613 if (line == lineObj) break;
7614 else h += line.height;
7615 }
7616 for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
7617 for (var i = 0; i < p.children.length; ++i) {
7618 var cur = p.children[i];
7619 if (cur == chunk) break;
7620 else h += cur.height;
7621 }
7622 }
7623 return h;
7624 }
7625
7626 // Get the bidi ordering for the given line (and cache it). Returns
7627 // false for lines that are fully left-to-right, and an array of

Callers 8

visibleLinesFunction · 0.70
updateDisplayIfNeededFunction · 0.70
intoCoordSystemFunction · 0.70
estimateCoordsFunction · 0.70
coordsCharInnerFunction · 0.70
codemirror.jsFile · 0.70
addLineWidgetFunction · 0.70

Calls 1

visualLineFunction · 0.70

Tested by

no test coverage detected