www.spaceplanner.app

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

commit 68579e4910209ab72d190226d5956f8ae154dc32
parent cb15ae130ceed6d1637d89e01b8a743426327073
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date:   Thu,  5 Sep 2024 10:45:41 -0700

Flesh out furniture applyOp's in editor

Actually use the size from the furniture in the furniture_map adding
function. Also update that size in the furniture adding/updating
function.

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

diff --git a/files/floorplans/floorplan/editor.js b/files/floorplans/floorplan/editor.js @@ -647,11 +647,26 @@ export class FloorplanEditor { .data("type", value.type) } }, - furniture: function() {}, + furniture: function(name, value) { + let ref = idRef(name) + let maps = editor.backend.cache.furniture_maps + for (let id in maps) { + if (maps[id].furniture_id == ref.id) { + let ref = backend.newRef("furniture_maps", id) + // May be added next + let m = editor.draw.findOneMax(byId(refId(ref))) + if (m != null) { + m.size(value.width, value.depth) + } + } + } + }, furniture_maps: function(name, value) { let fm = editor.draw.findOneMax(byId(name)) if (!fm) { - fm = editor.layoutG().rect(1600, 1600) + let f = editor.backend.cache.furniture[value.furniture_id] + console.log(f, editor.layoutG()) + fm = editor.layoutG().rect(f.width, f.depth) .cx(value.x).cy(value.y) .fill("black") .attr({ id: name })