瀏覽代碼

Gizmo: Only start moving if mouse is dragged beyond 5px

trethaller 7 年之前
父節點
當前提交
75905dbfa7
共有 1 個文件被更改,包括 11 次插入2 次删除
  1. 11 2
      hide/view/l3d/Gizmo.hx

+ 11 - 2
hide/view/l3d/Gizmo.hx

@@ -77,10 +77,19 @@ class Gizmo extends h3d.scene.Object {
 				mat.color.setColor(color);
 			}
 			interactive.onPush = function(e) {
-				startMove(mode);
+				var startPt = new h2d.col.Point(scene.s2d.mouseX, scene.s2d.mouseY);
+				updateFunc = function(dt) {
+					var mousePt = new h2d.col.Point(scene.s2d.mouseX, scene.s2d.mouseY);
+					if(mousePt.distance(startPt) > 5) {
+						startMove(mode);
+					}
+				}
 			}
 			interactive.onRelease = function(e) {
-				finishMove();
+				if(moving)
+					finishMove();
+				else
+					updateFunc = null;
 			}
 		}