MCPcopy
hub / github.com/HumanSignal/label-studio / measureCharPrepared

Function measureCharPrepared

docs/themes/htx/source/js/codemirror.js:3330–3357  ·  view source on GitHub ↗
(cm, prepared, ch, bias, varHeight)

Source from the content-addressed store, hash-verified

3328 // Given a prepared measurement object, measures the position of an
3329 // actual character (or fetches it from the cache).
3330 function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
3331 if (prepared.before) {
3332 ch = -1;
3333 }
3334 var key = ch + (bias || ""),
3335 found;
3336 if (prepared.cache.hasOwnProperty(key)) {
3337 found = prepared.cache[key];
3338 } else {
3339 if (!prepared.rect) {
3340 prepared.rect = prepared.view.text.getBoundingClientRect();
3341 }
3342 if (!prepared.hasHeights) {
3343 ensureLineHeights(cm, prepared.view, prepared.rect);
3344 prepared.hasHeights = true;
3345 }
3346 found = measureCharInner(cm, prepared, ch, bias);
3347 if (!found.bogus) {
3348 prepared.cache[key] = found;
3349 }
3350 }
3351 return {
3352 left: found.left,
3353 right: found.right,
3354 top: varHeight ? found.rtop : found.top,
3355 bottom: varHeight ? found.rbottom : found.bottom,
3356 };
3357 }
3358
3359 var nullRect = { left: 0, right: 0, top: 0, bottom: 0 };
3360

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