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

Function measureCharPrepared

samples/common/codehighlight/codemirror.js:2409–2427  ·  view source on GitHub ↗
(cm, prepared, ch, bias, varHeight)

Source from the content-addressed store, hash-verified

2407 // Given a prepared measurement object, measures the position of an
2408 // actual character (or fetches it from the cache).
2409 function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
2410 if (prepared.before) { ch = -1; }
2411 var key = ch + (bias || ""), found;
2412 if (prepared.cache.hasOwnProperty(key)) {
2413 found = prepared.cache[key];
2414 } else {
2415 if (!prepared.rect)
2416 { prepared.rect = prepared.view.text.getBoundingClientRect(); }
2417 if (!prepared.hasHeights) {
2418 ensureLineHeights(cm, prepared.view, prepared.rect);
2419 prepared.hasHeights = true;
2420 }
2421 found = measureCharInner(cm, prepared, ch, bias);
2422 if (!found.bogus) { prepared.cache[key] = found; }
2423 }
2424 return {left: found.left, right: found.right,
2425 top: varHeight ? found.rtop : found.top,
2426 bottom: varHeight ? found.rbottom : found.bottom}
2427 }
2428
2429 var nullRect = {left: 0, right: 0, top: 0, bottom: 0};
2430

Callers 7

measureCharFunction · 0.85
getFunction · 0.85
wrappedLineExtentFunction · 0.85
wrappedLineExtentCharFunction · 0.85
coordsCharInnerFunction · 0.85
coordsBidiPartWrappedFunction · 0.85
endOfLineFunction · 0.85

Calls 2

ensureLineHeightsFunction · 0.85
measureCharInnerFunction · 0.85

Tested by

no test coverage detected