commit 976471dc3b7a218a5687ec8ae1b5910c5ca9ac12
parent cfd122d6edea15da30a35a1038120aa8bd5a792c
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Tue, 17 Sep 2024 10:10:26 -0700
Fix furnitureHandler not getting mouseup
The precisePointHandler function was calling handled() even if it
had no state on mouseup, now it only calls handled if mouseup comes
after a mousedown that creates state.
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/files/floorplans/floorplan/main.js b/files/floorplans/floorplan/main.js
@@ -561,8 +561,11 @@ function precisePointHandler(event, editor, state) {
state.origin = state.from.vec()
} else if (event.type === "mouseup") {
- cleanup()
- //return // Or should I preventDefault()?
+ if (state.from) {
+ cleanup()
+ } else {
+ return
+ }
} else if (event.type === "mousemove" && state.origin != undefined &&
state.origin.distanceTo(cursor) > 200) {
state.to = editor.addPoint(cursor, true)