fix(admin): keep the region map canvas out of the layout
Foundation / checks (postgres) (push) Successful in 2m22s
Foundation / checks (ecs) (push) Successful in 2m23s
Foundation / checks (client) (push) Successful in 2m26s
Foundation / postgres-tools (push) Successful in 1m38s
Foundation / checks (network) (push) Successful in 2m22s
Foundation / server-image (push) Successful in 5m14s
Foundation / image (push) Successful in 6m17s
Foundation / checks (checks) (push) Successful in 2m27s
Foundation / checks (deploy) (push) Successful in 2m27s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 2m22s
Foundation / checks (ecs) (push) Successful in 2m23s
Foundation / checks (client) (push) Successful in 2m26s
Foundation / postgres-tools (push) Successful in 1m38s
Foundation / checks (network) (push) Successful in 2m22s
Foundation / server-image (push) Successful in 5m14s
Foundation / image (push) Successful in 6m17s
Foundation / checks (checks) (push) Successful in 2m27s
Foundation / checks (deploy) (push) Successful in 2m27s
Foundation / checks (tsan) (push) Successful in 5s
The map canvas is absolutely placed in its stage, so its backing size can never feed back into the page layout, and the backing store is capped at 2x and 4,096 pixels a side; a refused 2D context skips the paint instead of throwing. The tab bar no longer shows a vertical scrollbar, the overlays drop backdrop blur, and the theme icons are HTML entities. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -885,8 +885,10 @@ async function regionPage(region, params) {
|
||||
const depLayer = (d) => (d.kind === 2 ? channelNames[d.top] : d.kind === 1 ? 'pools' : 'patches');
|
||||
|
||||
function geometry() {
|
||||
// The backing store follows the laid-out size (the canvas is absolutely placed, so its own
|
||||
// size never feeds back into the layout), at most 2x and 4,096 pixels a side.
|
||||
const rect = canvas.getBoundingClientRect();
|
||||
const dpr = window.devicePixelRatio || 1;
|
||||
const dpr = Math.min(window.devicePixelRatio || 1, 2, 4096 / Math.max(1, rect.width, rect.height));
|
||||
const w = Math.max(1, Math.round(rect.width * dpr)), hgt = Math.max(1, Math.round(rect.height * dpr));
|
||||
if (canvas.width !== w || canvas.height !== hgt) { canvas.width = w; canvas.height = hgt; }
|
||||
const [aw, ah] = view ? view.area : [1, 1];
|
||||
@@ -918,8 +920,9 @@ async function regionPage(region, params) {
|
||||
};
|
||||
|
||||
function paint() {
|
||||
const ctx = canvas.getContext('2d');
|
||||
const g = geometry();
|
||||
const ctx = canvas.getContext('2d');
|
||||
if (!ctx) return; // The browser refused a context (lost or out of memory).
|
||||
ctx.fillStyle = css('map-bg');
|
||||
ctx.fillRect(0, 0, g.w, g.hgt);
|
||||
if (!view) return;
|
||||
@@ -1500,8 +1503,7 @@ async function start() {
|
||||
}
|
||||
if (!(await token())) return signedOut();
|
||||
const env = document.getElementById('env');
|
||||
env.textContent = `World ${config.world}`;
|
||||
env.hidden = !config.world;
|
||||
if (env) { env.textContent = `World ${config.world}`; env.hidden = !config.world; }
|
||||
try {
|
||||
const me = await api('/api/me');
|
||||
document.getElementById('who').textContent = me.email || me.subject;
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
<span id="env" class="env" hidden></span>
|
||||
<div class="theme-switch" role="group" aria-label="Theme">
|
||||
<button type="button" data-theme-choice="system" title="Follow the system">Auto</button>
|
||||
<button type="button" data-theme-choice="light" title="Light">☀</button>
|
||||
<button type="button" data-theme-choice="dark" title="Dark">☾</button>
|
||||
<button type="button" data-theme-choice="light" title="Light">☀</button>
|
||||
<button type="button" data-theme-choice="dark" title="Dark">☾</button>
|
||||
</div>
|
||||
<span id="who" class="muted small"></span>
|
||||
<button id="sign-out" class="ghost" hidden>Sign out</button>
|
||||
|
||||
@@ -347,7 +347,7 @@ dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
|
||||
|
||||
/* ---------- Region page ---------- */
|
||||
.region-grid { display: grid; grid-template-columns: minmax(0, 1fr) clamp(420px, 30vw, 560px); gap: 16px; align-items: start; }
|
||||
@media (max-width: 1150px) { .region-grid { grid-template-columns: 1fr; } }
|
||||
@media (max-width: 1150px) { .region-grid { grid-template-columns: minmax(0, 1fr); } }
|
||||
|
||||
.map-card {
|
||||
display: flex;
|
||||
@@ -360,12 +360,11 @@ dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
.map-toolbar { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
|
||||
.map-stage { position: relative; flex: 1; min-height: 0; background: var(--map-bg); }
|
||||
.map-stage canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }
|
||||
.map-stage { position: relative; flex: 1; min-height: 0; background: var(--map-bg); overflow: hidden; }
|
||||
.map-stage canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; cursor: crosshair; }
|
||||
.map-stage canvas.dragging { cursor: grabbing; }
|
||||
.glass {
|
||||
background: var(--map-glass);
|
||||
backdrop-filter: blur(8px);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius-sm);
|
||||
box-shadow: var(--shadow);
|
||||
@@ -447,7 +446,7 @@ dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
|
||||
overflow: hidden;
|
||||
}
|
||||
@media (max-width: 1150px) { .panel { position: static; max-height: none; } }
|
||||
.tabs { flex: none; display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); background: var(--panel-2); overflow-x: auto; }
|
||||
.tabs { flex: none; display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); background: var(--panel-2); overflow-x: auto; overflow-y: hidden; }
|
||||
.tabs button {
|
||||
border: 0;
|
||||
border-radius: var(--radius-sm) var(--radius-sm) 0 0;
|
||||
|
||||
Reference in New Issue
Block a user