MCPcopy Create free account
hub / github.com/TruthHun/BookStack / resolveScrollToPos

Function resolveScrollToPos

static/editor.md/lib/codemirror/lib/codemirror.js:4512–4523  ·  view source on GitHub ↗
(cm)

Source from the content-addressed store, hash-verified

4510 // 'simulates' scrolling that position into view in a cheap way, so
4511 // that the effect of intermediate scroll commands is not ignored.
4512 function resolveScrollToPos(cm) {
4513 var range = cm.curOp.scrollToPos;
4514 if (range) {
4515 cm.curOp.scrollToPos = null;
4516 var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);
4517 var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),
4518 Math.min(from.top, to.top) - range.margin,
4519 Math.max(from.right, to.right),
4520 Math.max(from.bottom, to.bottom) + range.margin);
4521 cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);
4522 }
4523 }
4524
4525 // API UTILITIES
4526

Callers 3

addToScrollPosFunction · 0.70
ensureCursorVisibleFunction · 0.70
codemirror.jsFile · 0.70

Calls 2

estimateCoordsFunction · 0.70
calculateScrollPosFunction · 0.70

Tested by

no test coverage detected