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

Function getDimensions

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

Source from the content-addressed store, hash-verified

812 // Do a bulk-read of the DOM positions and sizes needed to draw the
813 // view, so that we don't interleave reading and writing to the DOM.
814 function getDimensions(cm) {
815 var d = cm.display, left = {}, width = {};
816 var gutterLeft = d.gutters.clientLeft;
817 for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
818 left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;
819 width[cm.options.gutters[i]] = n.clientWidth;
820 }
821 return {fixedPos: compensateForHScroll(d),
822 gutterTotalWidth: d.gutters.offsetWidth,
823 gutterLeft: left,
824 gutterWidth: width,
825 wrapperWidth: d.wrapper.clientWidth};
826 }
827
828 // Sync the actual display DOM structure with display.view, removing
829 // 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