wrapped room table in .room-table-scene div, built styles and scripts to ensure table scales w. available viewport or aperture space
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -1,3 +1,23 @@
|
||||
(function () {
|
||||
var SCENE_W = 360, SCENE_H = 300;
|
||||
|
||||
function scaleTable() {
|
||||
var scene = document.querySelector('.room-table-scene');
|
||||
var container = document.getElementById('id_game_table');
|
||||
if (!scene || !container) return;
|
||||
var w = container.clientWidth, h = container.clientHeight;
|
||||
if (!w || !h) return;
|
||||
scene.style.transform = 'scale(' + Math.min(w / SCENE_W, h / SCENE_H) + ')';
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', scaleTable);
|
||||
} else {
|
||||
scaleTable();
|
||||
}
|
||||
window.addEventListener('resize', scaleTable);
|
||||
}());
|
||||
|
||||
(function () {
|
||||
const roomPage = document.querySelector('.room-page');
|
||||
if (!roomPage) return;
|
||||
|
||||
Reference in New Issue
Block a user