mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
fix(cockpit): a place pack that will not load ends the loading batch failed; flags keep their neighbours out from under the border and out of a scaled flag's edge; a new ride asks again for a sheet that failed
This commit is contained in:
1 parent
5a6cf22be1
commit
e954734379
16 files changed
+198
-55
No files matched your search
+10
-4
@@ -62,12 +62,18 @@ export function preloadOwnerFlags({
|
||||
export function ownerFlagStyle(code, { widthPx = 20, heightPx = 15 } = {}) {
|
||||
const index = SHEET_INDEX.get(code);
|
||||
if (index === undefined) return null;
|
||||
const column = index % OWNER_FLAG_SHEET.columns;
|
||||
const row = Math.floor(index / OWNER_FLAG_SHEET.columns);
|
||||
const sheet = OWNER_FLAG_SHEET;
|
||||
const column = index % sheet.columns;
|
||||
const row = Math.floor(index / sheet.columns);
|
||||
// A cell and its gutter, in CSS pixels at this size.
|
||||
const pitchX =
|
||||
(widthPx * (sheet.cellWidthPx + sheet.gutterPx)) / sheet.cellWidthPx;
|
||||
const pitchY =
|
||||
(heightPx * (sheet.cellHeightPx + sheet.gutterPx)) / sheet.cellHeightPx;
|
||||
return {
|
||||
backgroundImage: `url("${OWNER_FLAG_SHEET_URL}")`,
|
||||
backgroundSize: `${OWNER_FLAG_SHEET.columns * widthPx}px ${OWNER_FLAG_SHEET.rows * heightPx}px`,
|
||||
backgroundPosition: `${-column * widthPx}px ${-row * heightPx}px`,
|
||||
backgroundSize: `${sheet.columns * pitchX}px ${sheet.rows * pitchY}px`,
|
||||
backgroundPosition: `${-column * pitchX}px ${-row * pitchY}px`,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user