MCPcopy
hub / github.com/DHTMLX/gantt / alignHorizontally

Function alignHorizontally

samples/common/codehighlight/codemirror.js:4251–4269  ·  view source on GitHub ↗
(cm)

Source from the content-addressed store, hash-verified

4249 // Re-align line numbers and gutter marks to compensate for
4250 // horizontal scrolling.
4251 function alignHorizontally(cm) {
4252 var display = cm.display, view = display.view;
4253 if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }
4254 var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
4255 var gutterW = display.gutters.offsetWidth, left = comp + "px";
4256 for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {
4257 if (cm.options.fixedGutter) {
4258 if (view[i].gutter)
4259 { view[i].gutter.style.left = left; }
4260 if (view[i].gutterBackground)
4261 { view[i].gutterBackground.style.left = left; }
4262 }
4263 var align = view[i].alignable;
4264 if (align) { for (var j = 0; j < align.length; j++)
4265 { align[j].style.left = left; } }
4266 } }
4267 if (cm.options.fixedGutter)
4268 { display.gutters.style.left = (comp + gutterW) + "px"; }
4269 }
4270
4271 // Used to ensure that the line number gutter is still the right
4272 // size for the current document size. Returns true when an update

Callers 2

setScrollLeftFunction · 0.85
updateGuttersFunction · 0.85

Calls 1

compensateForHScrollFunction · 0.85

Tested by

no test coverage detected