dsfger
This commit is contained in:
parent
6a8372f92a
commit
ac96e554f4
File diff suppressed because one or more lines are too long
@ -208,5 +208,31 @@
|
||||
r.readAsDataURL(file);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
function scaleBoard() {
|
||||
const board = document.querySelector(".board");
|
||||
|
||||
const baseWidth = 1800;
|
||||
const baseHeight = 900;
|
||||
|
||||
const scaleX = window.innerWidth / baseWidth;
|
||||
const scaleY = window.innerHeight / baseHeight;
|
||||
|
||||
const scale = Math.max(Math.min(scaleX, scaleY), 1);
|
||||
|
||||
board.style.transform = `scale(${scale})`;
|
||||
|
||||
const offsetX = (window.innerWidth - baseWidth * scale) / 2;
|
||||
const offsetY = (window.innerHeight - baseHeight * scale) / 2;
|
||||
|
||||
board.style.left = offsetX + "px";
|
||||
board.style.top = offsetY + "px";
|
||||
}
|
||||
|
||||
window.addEventListener("resize", scaleBoard);
|
||||
window.addEventListener("load", scaleBoard);
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user