MCPcopy Index your code
hub / github.com/DHTMLX/gantt / visibleLines

Function visibleLines

samples/common/codehighlight/codemirror.js:3385–3404  ·  view source on GitHub ↗
(display, doc, viewport)

Source from the content-addressed store, hash-verified

3383 // the the current scroll position). viewport may contain top,
3384 // height, and ensure (see op.scrollToPos) properties.
3385 function visibleLines(display, doc, viewport) {
3386 var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;
3387 top = Math.floor(top - paddingTop(display));
3388 var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;
3389
3390 var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);
3391 // Ensure is a {from: {line, ch}, to: {line, ch}} object, and
3392 // forces those lines into the viewport (if possible).
3393 if (viewport && viewport.ensure) {
3394 var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;
3395 if (ensureFrom < from) {
3396 from = ensureFrom;
3397 to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);
3398 } else if (Math.min(ensureTo, doc.lastLine()) >= to) {
3399 from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);
3400 to = ensureTo;
3401 }
3402 }
3403 return {from: from, to: Math.max(to, from + 1)}
3404 }
3405
3406 // SCROLLING THINGS INTO VIEW
3407

Callers 3

DisplayUpdateFunction · 0.85
postUpdateDisplayFunction · 0.85
extendFunction · 0.85

Calls 4

paddingTopFunction · 0.85
lineAtHeightFunction · 0.85
heightAtLineFunction · 0.85
getLineFunction · 0.85

Tested by

no test coverage detected