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

Function findPosV

samples/common/codehighlight/codemirror.js:8735–8753  ·  view source on GitHub ↗
(cm, pos, dir, unit)

Source from the content-addressed store, hash-verified

8733 // "page" or "line". The resulting position will have a hitSide=true
8734 // property if it reached the end of the document.
8735 function findPosV(cm, pos, dir, unit) {
8736 var doc = cm.doc, x = pos.left, y;
8737 if (unit == "page") {
8738 var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
8739 var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);
8740 y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;
8741
8742 } else if (unit == "line") {
8743 y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
8744 }
8745 var target;
8746 for (;;) {
8747 target = coordsChar(cm, x, y);
8748 if (!target.outside) { break }
8749 if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }
8750 y += dir * 5;
8751 }
8752 return target
8753 }
8754
8755 // CONTENTEDITABLE INPUT STYLE
8756

Callers 1

addEditorMethodsFunction · 0.85

Calls 2

textHeightFunction · 0.85
coordsCharFunction · 0.85

Tested by

no test coverage detected