commit 7909b9b9d9c4130fe8ad3f58950b8abcca5a6160
parent 3313c3652598e16120c175545bb833285e7dff87
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Mon, 23 Sep 2024 12:16:55 -0700
Only set door swing when cursor has moved non-trivially
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/files/floorplans/floorplan/main.js b/files/floorplans/floorplan/main.js
@@ -652,7 +652,13 @@ function precisePointMapHandler(event, editor, state) {
if (state.door && event.type === "mouseup") {
handled(event)
- let o = editor.findObj(state.doorID).point_offset(cursor)
+
+ let door = editor.findObj(state.doorID)
+ if (state.doorSwingFrom.distanceTo(cursor) < 500) {
+ cleanup()
+ return
+ }
+ let o = door.point_offset(cursor)
if (state.hinge === "b") {
o = -o
}
@@ -694,6 +700,7 @@ function precisePointMapHandler(event, editor, state) {
handled(event)
state.door = data
state.doorID = id
+ state.doorSwingFrom = cursor.clone()
state.hinge = Math.round(editor.findObj(id).closestLinearInterpolation(cursor)) ? "b" : "a"
} else {
console.log("Hmm", event)