MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / heightAtLine

Function heightAtLine

lib/web/CodeMirror/src/line/spans.js:329–346  ·  view source on GitHub ↗
(lineObj)

Source from the content-addressed store, hash-verified

327
328// Find the height above the given line.
329export function heightAtLine(lineObj) {
330 lineObj = visualLine(lineObj)
331
332 let h = 0, chunk = lineObj.parent
333 for (let i = 0; i < chunk.lines.length; ++i) {
334 let line = chunk.lines[i]
335 if (line == lineObj) break
336 else h += line.height
337 }
338 for (let p = chunk.parent; p; chunk = p, p = chunk.parent) {
339 for (let i = 0; i < p.children.length; ++i) {
340 let cur = p.children[i]
341 if (cur == chunk) break
342 else h += cur.height
343 }
344 }
345 return h
346}
347
348// Compute the character length of a line, taking into account
349// collapsed ranges (see markText) that might hide parts, and join

Callers 8

updateDisplayIfNeededFunction · 0.90
visibleLinesFunction · 0.90
intoCoordSystemFunction · 0.90
estimateCoordsFunction · 0.90
coordsCharInnerFunction · 0.90
addLineWidgetFunction · 0.90
methods.jsFile · 0.90

Calls 1

visualLineFunction · 0.70

Tested by

no test coverage detected