UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

43 lines • 2.48 kB
import { Rect } from '@expofp/geometry'; import { type TextDef, type TextLineDef } from '@expofp/renderer'; import { type FontSizeFactor } from './defs'; export declare function updateLinesScale(lines: TextLineDef[], scale: number, fontSizes: [FontSizeFactor[], FontSizeFactor[]]): boolean; /** * Turns a text def's bounds by whole quarter turns, in one write. * * Each quarter turn swaps width and height, and two swaps cancel out. So turning by `turns` * quarters one at a time lands on the same rect as adding `turns · π/2` once and swapping only * when `turns` is odd — no loop needed. * * The bounds are written in place, not replaced: the drawers keep references to them. * @param textDef - The def to turn. * @param turns - Signed number of quarter turns, as {@link getQuarterTurns} returns. * @returns The same def. */ export declare function rotateTextDefByQuarters(textDef: TextDef, turns: number): TextDef; /** * Turns a plain rect by whole quarter turns: the transform {@link rotateTextDefByQuarters} applies, * where the swap-on-odd rule is explained. Returns a new rect, since nothing else holds this one. * @param rect - The rect to turn. * @param turns - Signed number of quarter turns, as {@link getQuarterTurns} returns. * @returns The turned rect. */ export declare function rotateRectByQuarters(rect: Rect, turns: number): Rect; /** * How many 90° steps a def is behind the camera, signed: the whole distance, so a camera that * jumped is caught up with in one write. * @param newAngle - The angle turned to, in radians. * @param currentRotation - The angle turned from, in radians. * @returns The signed number of quarters; `0` within 45° and for a non-finite angle. */ export declare function getQuarterTurns(newAngle: number, currentRotation: number): number; export declare function shouldFlip(newAngle: number, currentRotation: number): boolean; export declare function flipAngle(angle: number): number; export declare function getClampedBoundsCanvas(rect: Rect, canvas: HTMLCanvasElement, padding: number, scale: number): Rect; /** * Reads the `roll` map setting — `1`/`0`, from the URL or the venue — as a boolean, refusing * anything else. The label configs consult it before declaring their `onRoll` rules: with roll * disabled the plan never turns, so a counter-rotation would only ever fight a stale angle. */ export declare function getRollValue(value: 1 | 0): boolean; //# sourceMappingURL=update-def.d.ts.map