mirror of
https://github.com/tiennm99/sokoban.git
synced 2026-10-13 06:15:45 +00:00
fix: prevent large levels from overflowing the viewport
Add scrollable overflow to board wrapper, use safe centering to avoid top-cropping, and lower minimum tile size from 16px to 10px.
This commit is contained in:
1 parent
8a3d4b4a9d
commit
d46ccb6d50
2 files changed
+5
-2
No files matched your search
+1
-1
@@ -53,7 +53,7 @@ html, body {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
align-items: safe center;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
function computeTileSize() {
|
||||
if (!level) return 48;
|
||||
const maxTile = 56;
|
||||
const minTile = 16;
|
||||
const minTile = 10;
|
||||
const margin = 140; // header + hud + padding
|
||||
const maxByWidth = Math.floor((window.innerWidth - 80) / level.width);
|
||||
const maxByHeight = Math.floor((window.innerHeight - margin - 100) / level.height);
|
||||
@@ -199,6 +199,9 @@
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
overflow: auto;
|
||||
max-height: calc(100vh - 140px);
|
||||
max-width: calc(100vw - 48px);
|
||||
}
|
||||
|
||||
.error {
|
||||
|
||||
Reference in new issue
Block a user