MCPcopy
hub / github.com/compiler-explorer/compiler-explorer / constructor

Method constructor

static/widgets/fontscale.ts:99–115  ·  view source on GitHub ↗
(domRoot: JQuery, state: FontScaleState & any, fontSelectorOrEditor: JQuery | string | IEditor)

Source from the content-addressed store, hash-verified

97 private isFontOfStr: boolean;
98
99 constructor(domRoot: JQuery, state: FontScaleState & any, fontSelectorOrEditor: JQuery | string | IEditor) {
100 super();
101 this.domRoot = domRoot;
102 // Old scale went from 0.3 to 3. New one uses 8 up to 30, so we can convert the old ones to the new format
103 this.scale = state.fontScale || getDefaultFontScale();
104 // The check seems pointless, but it ensures a false in case it's undefined
105 // FontScale assumes it's an old state if it does not see a fontUsePx in the state, so at first it will use pt.
106 // So the second condition is there to make new objects actually use px
107 this.usePxUnits = state.fontUsePx === true || !state.fontScale;
108 if (this.scale < 8) {
109 this.scale = convertOldScale(this.scale);
110 }
111 this.setTarget(fontSelectorOrEditor);
112 this.apply();
113 this.fontSizeList = this.domRoot.find('.font-size-list');
114 makeFontSizeDropdown(this.fontSizeList, this, this.domRoot.find('.fs-button'));
115 }
116
117 apply() {
118 if (this.isFontOfStr) {

Callers

nothing calls this directly

Calls 6

setTargetMethod · 0.95
applyMethod · 0.95
getDefaultFontScaleFunction · 0.85
convertOldScaleFunction · 0.85
makeFontSizeDropdownFunction · 0.85
findMethod · 0.80

Tested by

no test coverage detected