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

Function alignHorizontally

static/mergely/lib/codemirror.js:587–601  ·  view source on GitHub ↗
(cm)

Source from the content-addressed store, hash-verified

585 // Re-align line numbers and gutter marks to compensate for
586 // horizontal scrolling.
587 function alignHorizontally(cm) {
588 var display = cm.display, view = display.view;
589 if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;
590 var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
591 var gutterW = display.gutters.offsetWidth, left = comp + "px";
592 for (var i = 0; i < view.length; i++) if (!view[i].hidden) {
593 if (cm.options.fixedGutter && view[i].gutter)
594 view[i].gutter.style.left = left;
595 var align = view[i].alignable;
596 if (align) for (var j = 0; j < align.length; j++)
597 align[j].style.left = left;
598 }
599 if (cm.options.fixedGutter)
600 display.gutters.style.left = (comp + gutterW) + "px";
601 }
602
603 // Used to ensure that the line number gutter is still the right
604 // size for the current document size. Returns true when an update

Callers 3

guttersChangedFunction · 0.70
endOperation_finishFunction · 0.70
setScrollLeftFunction · 0.70

Calls 1

compensateForHScrollFunction · 0.70

Tested by

no test coverage detected