Explorar el Código

Better lock mouse editing (#130)

When using right click and wheel click on l3d, the mouse is now lock which is better to move and rotate the camera around.
Remove the lock mouse feature when editing gizmo in translation mode. The object follows perfectly the cursor, it is more intuitive.
Jed974 hace 4 años
padre
commit
128c20c998
Se han modificado 2 ficheros con 4 adiciones y 1 borrados
  1. 2 1
      hide/view/l3d/Gizmo.hx
  2. 2 0
      hide/view/l3d/Level3D.hx

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

@@ -113,7 +113,8 @@ class Gizmo extends h3d.scene.Object {
 	}
 
 	public function startMove(mode: TransformMode, ?duplicating=false) {
-		mouseLock = true;
+		if (mode == Scale || mode == RotateX || mode == RotateY || mode == RotateZ)
+			mouseLock = true;
 		moving = true;
 		if(onStartMove != null) onStartMove(mode);
 		var startMat = getAbsPos().clone();

+ 2 - 0
hide/view/l3d/Level3D.hx

@@ -42,12 +42,14 @@ class CamController extends h3d.scene.CameraController {
 			pushStartX = pushX = e.relX;
 			pushStartY = pushY = e.relY;
 			startPush = new h2d.col.Point(pushX, pushY);
+			@:privateAccess scene.window.mouseLock = true;
 		case ERelease, EReleaseOutside:
 			if( pushing == e.button ) {
 				pushing = -1;
 				startPush = null;
 				if( e.kind == ERelease && haxe.Timer.stamp() - pushTime < 0.2 && hxd.Math.distance(e.relX - pushStartX,e.relY - pushStartY) < 5 )
 					onClick(e);
+				@:privateAccess scene.window.mouseLock = false;
 			}
 		case EMove:
 			switch( pushing ) {