www.spaceplanner.app

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

commit 69d235c39adce6d589f64985e7848ed7fa45ac6c
parent 4d5149d455ffd8fb49856b1650de4223c1bf21d3
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date:   Thu,  3 Oct 2024 10:27:11 -0700

Initialize pointmap type in type selector

So long as every selected pointmap is of the same type, the selector
will be initialized to that type. Otherwise it's left undefined.
(Of course, currently you can only select on thing at a time anyway.)

Diffstat:
Mfiles/floorplans/floorplan/main.js | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/files/floorplans/floorplan/main.js b/files/floorplans/floorplan/main.js @@ -193,8 +193,15 @@ function selectHandler(event, editor, state) { editor.mapPoints(newvalue, maps[i].a, maps[i].b) } } + let current = maps[0].type + for (let i = 0; i < maps.length; ++i) { + if (current !== maps[i].type) { + current = null + break; + } + } c.appendChild( - selector({ wall: true, door: true }, changeTypes, { text: "Type:" }) + selector({ wall: true, door: true }, changeTypes, { current, text: "Type:" }) ) }