MCPcopy
hub / github.com/rikschennink/fitty / computeStyle

Function computeStyle

src/fitty.js:99–112  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

97
98 // every fitty element is tested for invalid styles
99 const computeStyle = (f) => {
100 // get style properties
101 const style = w.getComputedStyle(f.element, null);
102
103 // get current font size in pixels (if we already calculated it, use the calculated version)
104 f.currentFontSize = parseFloat(style.getPropertyValue('font-size'));
105
106 // get display type and wrap mode
107 f.display = style.getPropertyValue('display');
108 f.whiteSpace = style.getPropertyValue('white-space');
109
110 // styles computed
111 return true;
112 };
113
114 // determines if this fitty requires initial styling, can be prevented by applying correct styles through CSS
115 const shouldPreStyle = (f) => {

Callers 1

redrawFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…