- commit
- 2136753614725f205bf13db820a197383a74eff7
- parent
- 462e8a339bd0469207a4f0f0752f88a0970f7c94
- author
- dami <gazey55@gmail.com>
| M | site/ | 5 | ++++- |
@@ -224,14 +224,17 @@ export type Box = { x0: number; y0: number; x1: number; y1: number };
224224 export function boxOf(225225 tiles: readonly { x0: number; y0: number; w: number; h: number }[],226226 ): Box | null {227- if (tiles.length === 0) return null;228227 let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;229228 for (const t of tiles) {229+ // a placeholder (the fogged live view: a tile known only by id) has230+ // no shape and frames nothing231+ if (t.w <= 0 || t.h <= 0) continue;230232 if (t.x0 < x0) x0 = t.x0;231233 if (t.y0 < y0) y0 = t.y0;232234 if (t.x0 + t.w - 1 > x1) x1 = t.x0 + t.w - 1;233235 if (t.y0 + t.h - 1 > y1) y1 = t.y0 + t.h - 1;234236 }237+ if (x0 === Infinity) return null;235238 return { x0, y0, x1, y1 };236239 }237240