www.spaceplanner.app

Web client to the spaceplanner API
git clone git://jacobedwards.org/www.spaceplanner.app
Log | Files | Refs

commit 61ab8cd178ce3b94438e624ddae9697dbed5f88c
parent 23f99c252a8013764f54a9ba20a64e35727a6cd6
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date:   Mon, 19 Aug 2024 09:10:00 -0700

Add Editor method to switch to using a different unit system

Also a little getter function to get the base unit of the current
system (which in the future might not necessarily be the smallest).

Diffstat:
Mfiles/floorplans/floorplan/editor.js | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/files/floorplans/floorplan/editor.js b/files/floorplans/floorplan/editor.js @@ -177,6 +177,18 @@ export class FloorplanEditor { resize.observe(editor.draw.node) } + useUnits(system) { + if (!this.units.systems[system]) { + throw new Error("No such system") + } + this.unitSystem = system + this.useGrid(system) + } + + get unit() { + return this.units.systems[this.unitSystem] + } + addMode(name, mode) { if (this.modes[name]) { throw new Error("Mode already exists")