MCPcopy
hub / github.com/DHTMLX/gantt / lineAtHeight

Function lineAtHeight

samples/common/codehighlight/codemirror.js:948–966  ·  view source on GitHub ↗
(chunk, h)

Source from the content-addressed store, hash-verified

946 // Find the line at the given vertical position, using the height
947 // information in the document tree.
948 function lineAtHeight(chunk, h) {
949 var n = chunk.first;
950 outer: do {
951 for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {
952 var child = chunk.children[i$1], ch = child.height;
953 if (h < ch) { chunk = child; continue outer }
954 h -= ch;
955 n += child.chunkSize();
956 }
957 return n
958 } while (!chunk.lines)
959 var i = 0;
960 for (; i < chunk.lines.length; ++i) {
961 var line = chunk.lines[i], lh = line.height;
962 if (h < lh) { break }
963 h -= lh;
964 }
965 return n + i
966 }
967
968 function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}
969

Callers 4

coordsCharFunction · 0.85
visibleLinesFunction · 0.85
gutterEventFunction · 0.85
addEditorMethodsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected