MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / applyUiZoomSetting

Method applyUiZoomSetting

src/lib/settings.js:437–469  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

435 }
436
437 applyUiZoomSetting() {
438 const zoom = Number(this.value.uiZoom) || 100;
439 const clamped = Math.min(160, Math.max(70, zoom));
440 if (clamped === 100) {
441 document.documentElement.style.fontSize = "";
442 document.body.style.fontSize = "";
443 if (window.root) {
444 window.root.style.zoom = "";
445 window.root.style.width = "";
446 window.root.style.height = "";
447 }
448 return;
449 }
450
451 const rootFontSize =
452 this.#uiZoomBaseFontSize.root ||
453 Number.parseFloat(getComputedStyle(document.documentElement).fontSize) ||
454 14;
455 const bodyFontSize =
456 this.#uiZoomBaseFontSize.body ||
457 Number.parseFloat(getComputedStyle(document.body).fontSize) ||
458 rootFontSize;
459
460 this.#uiZoomBaseFontSize.root = rootFontSize;
461 this.#uiZoomBaseFontSize.body = bodyFontSize;
462 document.documentElement.style.fontSize = `${(rootFontSize * clamped) / 100}px`;
463 document.body.style.fontSize = `${(bodyFontSize * clamped) / 100}px`;
464 if (window.root) {
465 window.root.style.zoom = "";
466 window.root.style.width = "";
467 window.root.style.height = "";
468 }
469 }
470
471 async applyLangSetting() {
472 const value = this.value.lang;

Callers 2

#applySettingsMethod · 0.95
beforeRenderFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected