MCPcopy Index your code
hub / github.com/DHTMLX/gantt / charWidth

Function charWidth

samples/common/codehighlight/codemirror.js:2889–2897  ·  view source on GitHub ↗
(display)

Source from the content-addressed store, hash-verified

2887
2888 // Compute the default character width.
2889 function charWidth(display) {
2890 if (display.cachedCharWidth != null) { return display.cachedCharWidth }
2891 var anchor = elt("span", "xxxxxxxxxx");
2892 var pre = elt("pre", [anchor], "CodeMirror-line-like");
2893 removeChildrenAndAdd(display.measure, pre);
2894 var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
2895 if (width > 2) { display.cachedCharWidth = width; }
2896 return width || 10
2897 }
2898
2899 // Do a bulk-read of the DOM positions and sizes needed to draw the
2900 // view, so that we don't interleave reading and writing to the DOM.

Callers 6

measureCharInnerFunction · 0.85
estimateCoordsFunction · 0.85
estimateHeightFunction · 0.85
posFromMouseFunction · 0.85
updateHeightsInViewportFunction · 0.85
addEditorMethodsFunction · 0.85

Calls 2

eltFunction · 0.85
removeChildrenAndAddFunction · 0.85

Tested by

no test coverage detected