commit 48cc1a0e2ae6ade542f84d3b8af96d02972b620e
parent 60f58bf3b3cc9630a86998b1fd6591dac1d1453c
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Mon, 19 Aug 2024 09:45:15 -0700
Add top and bottom ui groups
Obviously sometimes you want ui elements on top, and sometimes on
bottom. There will probably be other cases too, but this can be
expanded at that time (maybe start using ui class in addition for
very specific cases).
Diffstat:
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/files/floorplans/floorplan/editor.js b/files/floorplans/floorplan/editor.js
@@ -214,12 +214,15 @@ export class FloorplanEditor {
this.draw.rect().attr({ id: "grid" })
- this.ui = this.draw.group().attr({ id: "ui" })
+ this.ui = {}
+ this.ui.bottom = this.draw.group().attr({ id: "bottom" })
let data = this.draw.group().attr({ id: "floorplan" })
data.group().attr({ id: "walls" }) // lines
data.group().attr({ id: "points" }) // circles
+ this.ui.top = this.draw.group().attr({ id: "top" })
+
// Resize grid when appropriate
this.draw.on("zoom", function(event) {
editor.updateGrid(event.detail.box)
diff --git a/files/floorplans/floorplan/main.js b/files/floorplans/floorplan/main.js
@@ -249,10 +249,10 @@ function preciseAddWallHandler(event, editor, state) {
return
}
state.moving = true
- state.line = editor.ui.line()
+ state.line = editor.ui.bottom.line()
.addClass("wall")
.addClass("preview")
- state.point = editor.ui.circle()
+ state.point = editor.ui.top.circle()
.addClass("point")
.addClass("preview")
.select()