瀏覽代碼

CameraController: fix capture exception on JS

trethaller 2 年之前
父節點
當前提交
12d6ab0fc3
共有 1 個文件被更改,包括 1 次插入3 次删除
  1. 1 3
      h3d/scene/CameraController.hx

+ 1 - 3
h3d/scene/CameraController.hx

@@ -159,8 +159,8 @@ class CameraController extends h3d.scene.Object {
 			@:privateAccess scene.events.startCapture(onEvent, function() {
 				pushing = -1;
 				var wnd = hxd.Window.getInstance();
-				wnd.mouseMode = Absolute;
 				wnd.setCursorPos(Std.int(pushStartX), Std.int(pushStartY));
+				wnd.mouseMode = Absolute;
 			}, e.touchId);
 			pushing = e.button;
 			pushTime = haxe.Timer.stamp();
@@ -171,8 +171,6 @@ class CameraController extends h3d.scene.Object {
 			if( pushing == e.button ) {
 				pushing = -1;
 				var wnd = hxd.Window.getInstance();
-				wnd.mouseMode = Absolute;
-				wnd.setCursorPos(Std.int(pushStartX), Std.int(pushStartY));
 				@:privateAccess scene.events.stopCapture();
 				if( e.kind == ERelease && haxe.Timer.stamp() - pushTime < 0.2 && hxd.Math.distance(e.relX - pushStartX,e.relY - pushStartY) < 5 )
 					onClick(e);