MCPcopy Create free account
hub / github.com/breck7/scroll / heightAtLine

Function heightAtLine

external/.scrollLibs.js:1590–1614  ·  view source on GitHub ↗
(lineObj)

Source from the content-addressed store, hash-verified

1588
1589 // Find the height above the given line.
1590 function heightAtLine(lineObj) {
1591 lineObj = visualLine(lineObj)
1592
1593 var h = 0,
1594 chunk = lineObj.parent
1595 for (var i = 0; i < chunk.lines.length; ++i) {
1596 var line = chunk.lines[i]
1597 if (line == lineObj) {
1598 break
1599 } else {
1600 h += line.height
1601 }
1602 }
1603 for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
1604 for (var i$1 = 0; i$1 < p.children.length; ++i$1) {
1605 var cur = p.children[i$1]
1606 if (cur == chunk) {
1607 break
1608 } else {
1609 h += cur.height
1610 }
1611 }
1612 }
1613 return h
1614 }
1615
1616 // Compute the character length of a line, taking into account
1617 // collapsed ranges (see markText) that might hide parts, and join

Callers 8

intoCoordSystemFunction · 0.85
estimateCoordsFunction · 0.85
coordsCharInnerFunction · 0.85
visibleLinesFunction · 0.85
updateDisplayIfNeededFunction · 0.85
addLineWidgetFunction · 0.85
addEditorMethodsFunction · 0.85

Calls 1

visualLineFunction · 0.85

Tested by

no test coverage detected