Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 8x 8x 6x 8x 5x 8x 14x 8x 4x 4x | import { NUM_SUBPIXEL_BITS } from "consts"; import type { DistanceUnitType } from "shared/lib/entities/entitiesTypes"; export const tileToSubpx = (x: number) => Math.floor(x * (1 << (3 + NUM_SUBPIXEL_BITS))); export const pxToSubpx = (x: number) => Math.floor(x * (1 << NUM_SUBPIXEL_BITS)); export const subpxShiftForUnits = (units: DistanceUnitType) => { return units === "tiles" ? NUM_SUBPIXEL_BITS + 3 : NUM_SUBPIXEL_BITS; }; export const unitsValueToSubpx = (x: number, units: DistanceUnitType) => { if (units === "tiles") { return tileToSubpx(x); } return pxToSubpx(x); }; |