@expofp/floorplan
Version:
Interactive floor plan library for expos and events
31 lines • 1.68 kB
TypeScript
import { type ModelDef } from '@expofp/renderer';
/**
* The attribute that turns a designer `<image>` into a 3D model: the URL of a
* .glb/.gltf, authored relative to the drawing. `@expofp/config` rebases it
* with every other asset URL the drawing carries when the payload loads, so
* what arrives here is already resolved — absolute for a live load,
* page-relative or rooted for an offline copy.
*/
export declare const MODEL_3D_ATTRIBUTE = "data-model-3d";
/**
* The rotation an element's `transform` carries, in radians.
*
* Only the first transform in the list is read, which is what the designer emits. It inherits the
* assumption `loadLayerImages` has always made: an SVG `rotate(a, cx, cy)` is treated as pivoting
* about the element's own center, because that is what a geometry `Rect` does. A transform with a
* different pivot is placed wrongly — pre-existing behavior, recorded rather than fixed here.
* @param element - The graphic to read.
* @returns The rotation in radians, positive = clockwise.
*/
export declare function svgTransformRotation(element: SVGGraphicsElement): number;
/**
* Builds a {@link ModelDef} from an `<image>` carrying {@link MODEL_3D_ATTRIBUTE}.
*
* Bounds come from the element's own x/y/width/height — `Box.fromSvg` reads an `<image>` as readily
* as a `<rect>` — combined with its transform's rotation. The URL is taken verbatim: the drawing
* reaches the runtime with its asset URLs already resolved.
* @param element - The placeholder image.
* @returns The model def.
*/
export declare function createModelDefFromElement(element: SVGImageElement): ModelDef;
//# sourceMappingURL=layer-models.d.ts.map