}
setCellCaptions(getSetting("CELL_CAPTIONS"));
+ if (window.CSS && CSS.supports && CSS.supports("zoom: 1.5")) {
+ resize();
+ window.removeEventListener("resize", resize);
+ window.addEventListener("resize", resize);
+ }
}
function initLang() {
document.getElementsByTagName("head")[0].appendChild(script);
}
+ function resize() {
+ const content = document.getElementById("content");
+ const panel = document.getElementById("panel");
+ const menu = document.getElementById("menu");
+ const screenWidth = window.innerWidth || document.documentElement.clientWidth ||
+ document.body.clientWidth;
+ const screenHeight = window.innerHeight|| document.documentElement.clientHeight||
+ document.body.clientHeight;
+ const menuAndPanelWidth = panel.offsetWidth + menu.offsetWidth;
+ const availableWidth = screenWidth - menuAndPanelWidth;
+ const candidateScaleW = availableWidth / board.offsetWidth;
+ // RJ - The - 5 is a hack to avoid scrollbars and to prevent the rack
+ // from being too close from the bottom of the screen.
+ // It is an arbitrary value guessed from observation. It's not very
+ // pretty and I don't know why scrollbars appear without it.
+ const candidateScaleH = (screenHeight - 5) / content.offsetHeight;
+ const candidateScale = Math.min(candidateScaleW, candidateScaleH)
+ if (candidateScale < 1) {
+ candidateScale = 1;
+ }
+ content.style.zoom = candidateScale;
+ }
+
function load() {
initLang();
loadBagSVG();
});
window.addEventListener("online", startConnection);
-
}());