www.spaceplanner.app

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

commit 0f74fed14a1dd09b0f16523ca67ed0df4df24563
parent 6be819ced34ab84c2a84f15b00732de4c02f7a91
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date:   Fri, 11 Oct 2024 17:54:10 -0700

setCustomValidity in furnitureMenu when size <= zero

Now the furniture menu reports invalid width and depth using the
input's setCustomValidity and reportValidity methods. Much nicer.
(Before it would be caught by addMappedFurniture which would be
displayed with etc.error on the menu itself, and wouldn't go away
unless manually dismissed.)

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

diff --git a/files/floorplans/floorplan/main.js b/files/floorplans/floorplan/main.js @@ -1019,6 +1019,12 @@ function furnitureMenuX(editor, pointOrID) { if (u == undefined) { return } + if (u <= 0) { + ev.target.setCustomValidity(ui.capitalize(ev.target.name) + " must be greater than zero") + } else { + ev.target.setCustomValidity("") + } + ev.target.reportValidity() params[ev.target.name] = u items[keys.variety].input.value = editor.varietyFrom(params) } else {