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

Function charWidth

static/mergely/lib/codemirror.js:2967–2975  ·  view source on GitHub ↗
(display)

Source from the content-addressed store, hash-verified

2965
2966 // Compute the default character width.
2967 function charWidth(display) {
2968 if (display.cachedCharWidth != null) return display.cachedCharWidth;
2969 var anchor = elt("span", "xxxxxxxxxx");
2970 var pre = elt("pre", [anchor]);
2971 removeChildrenAndAdd(display.measure, pre);
2972 var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
2973 if (width > 2) display.cachedCharWidth = width;
2974 return width || 10;
2975 }
2976
2977 // OPERATIONS
2978

Callers 5

estimateHeightFunction · 0.70
measureCharInnerFunction · 0.70
estimateCoordsFunction · 0.70
posFromMouseFunction · 0.70
codemirror.jsFile · 0.70

Calls 2

eltFunction · 0.70
removeChildrenAndAddFunction · 0.70

Tested by

no test coverage detected