aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Lyngstol <kly@kly.no>2016-03-13 18:48:39 +0000
committerKristian Lyngstol <kly@kly.no>2016-03-13 18:48:39 +0000
commitfe776bbc6f2e62436acea72f2f3bf027a6138ed8 (patch)
tree263526056b4db496b5011e780e9d7869492af16e
parentd79ea3095ac5da8344ab727bcb84a73043bbb533 (diff)
NMS: Fix switch moving bug
If you just clicked a switch without moving it would use whatever coordinates were laying around, typically moving the switch onto the previously moved one.
-rw-r--r--web/nms.gathering.org/js/nms-map.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/web/nms.gathering.org/js/nms-map.js b/web/nms.gathering.org/js/nms-map.js
index 13a8103..b4f10b5 100644
--- a/web/nms.gathering.org/js/nms-map.js
+++ b/web/nms.gathering.org/js/nms-map.js
@@ -383,14 +383,17 @@ nmsMap._moveStopListen = function() {
nmsMap._moveDone = function(e) {
nmsMap._moveStopListen();
+ if(nmsMap._moveOldBox == false) {
+ return;
+ }
nmsMap._moveSubmit();
nmsMap._clearOld(nmsMap._moveOldBox);
}
nmsMap._moveStart = function(sw, e)
{
- console.log("moving " + sw);
nmsMap._moving = sw;
+ nmsMap._moveOldBox = false;
nmsMap._moveXstart = (e.pageX - e.target.offsetLeft) / nmsMap.scale;
nmsMap._moveYstart = (e.pageY - e.target.offsetTop) / nmsMap.scale;
nmsMap._moveBox = nmsData.switches.switches[sw].placement;