MCPcopy
hub / github.com/csev/py4e / resolveScrollToPos

Function resolveScrollToPos

tools/pythonauto/static/codemirrorepl/codemirror.js:3578–3589  ·  view source on GitHub ↗
(cm)

Source from the content-addressed store, hash-verified

3576 // 'simulates' scrolling that position into view in a cheap way, so
3577 // that the effect of intermediate scroll commands is not ignored.
3578 function resolveScrollToPos(cm) {
3579 var range = cm.curOp.scrollToPos;
3580 if (range) {
3581 cm.curOp.scrollToPos = null;
3582 var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);
3583 var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),
3584 Math.min(from.top, to.top) - range.margin,
3585 Math.max(from.right, to.right),
3586 Math.max(from.bottom, to.bottom) + range.margin);
3587 cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);
3588 }
3589 }
3590
3591 // API UTILITIES
3592

Callers 3

addToScrollPosFunction · 0.85
ensureCursorVisibleFunction · 0.85
codemirror.jsFile · 0.85

Calls 2

estimateCoordsFunction · 0.85
calculateScrollPosFunction · 0.70

Tested by

no test coverage detected