Explorar el Código

TransformControls: Set axis before triggering mouseDownEvent

In my case for example I have a listener to the mousedown event. In this listener I check for the current set axis. But of course it is ```null``` because it is set just after the event was triggered.
So my suggestion is to set the axis and AFTERWARDS trigger the event.
Pascal Häusler hace 7 años
padre
commit
7de3906eb4
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      examples/js/controls/TransformControls.js

+ 2 - 2
examples/js/controls/TransformControls.js

@@ -856,10 +856,10 @@
 					event.preventDefault();
 					event.stopPropagation();
 
-					scope.dispatchEvent( mouseDownEvent );
-
 					scope.axis = intersect.object.name;
 
+					scope.dispatchEvent( mouseDownEvent );
+
 					scope.update();
 
 					eye.copy( camPosition ).sub( worldPosition ).normalize();