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

Function getDimensions

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

Source from the content-addressed store, hash-verified

829 // Do a bulk-read of the DOM positions and sizes needed to draw the
830 // view, so that we don't interleave reading and writing to the DOM.
831 function getDimensions(cm) {
832 var d = cm.display, left = {}, width = {};
833 var gutterLeft = d.gutters.clientLeft;
834 for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
835 left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;
836 width[cm.options.gutters[i]] = n.clientWidth;
837 }
838 return {fixedPos: compensateForHScroll(d),
839 gutterTotalWidth: d.gutters.offsetWidth,
840 gutterLeft: left,
841 gutterWidth: width,
842 wrapperWidth: d.wrapper.clientWidth};
843 }
844
845 // Sync the actual display DOM structure with display.view, removing
846 // nodes for lines that are no longer in view, and creating the ones

Callers 3

DisplayUpdateFunction · 0.70
updateDisplayIfNeededFunction · 0.70
prepareMeasureForLineFunction · 0.70

Calls 1

compensateForHScrollFunction · 0.70

Tested by

no test coverage detected