www.spaceplanner.app

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

commit 7fd01d39836e4c58922af263f48c0eb639589d96
parent cdd056bc443b0bfc3112ee5521888d2bb3c5f5a8
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date:   Fri, 23 Aug 2024 14:45:50 -0700

Add removePoint method to Editor

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

diff --git a/files/floorplans/floorplan/editor.js b/files/floorplans/floorplan/editor.js @@ -383,6 +383,11 @@ export class FloorplanEditor { return this.selectedPoint() } + removePoint(point) { + this.backend.removePoint(getId(point), { recurse: true }) + this.updateDisplay() + } + pointAt(point) { return this.thingAt(point, "#points") } @@ -587,6 +592,20 @@ function gridSystem(editor, system) { return last } +function getId(thing) { + console.debug("getId", thing) + if (typeof thing === "object") { + return idRef(thing.attr("id")).id + } + if (typeof thing === "string") { + return idRef(thing).id + } + if (typeof thing === "number") { + return thing + } + throw new Error("Invalid ID") +} + function byId(id) { return "#" + id }