Add responsive UI scaling for server browser
Introduce resolution-aware UI scaling to keep fonts, glyphs, and panel chrome readable and aligned above 1920×1080. Adds a new components/layout.js that sets --co-ui-scale (baseline 1920×1080) on load/resize and exposes CO_Layout.update; index.html now loads it and app.js triggers updates onBrowserShown and on window resize. styles.css converts many fixed px values to calc()/em driven by --co-ui-scale, removes the old pixel-floor media queries and clamp caps, and scales borders, spacing, and font sizes. controller-glyphs.js multiplies glyph dimensions by the UI scale so controller icons grow correctly. Changes address small/drifting server browser content on high-res and ultrawide displays.
This commit is contained in:
@@ -78,6 +78,12 @@
|
||||
};
|
||||
}
|
||||
|
||||
function getUiScale() {
|
||||
var style = getComputedStyle(document.documentElement);
|
||||
var scale = parseFloat(style.getPropertyValue("--co-ui-scale"));
|
||||
return isFinite(scale) && scale > 0 ? scale : 1;
|
||||
}
|
||||
|
||||
function tintCacheKey(url, color) {
|
||||
return url + "|" + color.r + "," + color.g + "," + color.b;
|
||||
}
|
||||
@@ -206,6 +212,7 @@
|
||||
}
|
||||
|
||||
var size = GLYPH_SIZES[glyphId] || GLYPH_SIZES.a;
|
||||
var scale = getUiScale();
|
||||
var url = glyphUrl(glyphId);
|
||||
if (!url) {
|
||||
return '<span class="co-prompt-key co-prompt-key--fallback">' + key + "</span>";
|
||||
@@ -213,7 +220,7 @@
|
||||
|
||||
return (
|
||||
'<span class="co-prompt-key co-prompt-key--glyph co-prompt-key--' + glyphId + '"' +
|
||||
' style="width:' + size.w + "px;height:" + size.h + 'px"' +
|
||||
' style="width:' + (size.w * scale) + "px;height:" + (size.h * scale) + 'px"' +
|
||||
' aria-hidden="true">' +
|
||||
'<img class="co-glyph-img" data-glyph-src="' + url + '" src="' + url + '" alt="" draggable="false" />' +
|
||||
"</span>"
|
||||
|
||||
Reference in New Issue
Block a user