|
@@ -34,6 +34,7 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
defineProperty( "mode", "translate" );
|
|
defineProperty( "mode", "translate" );
|
|
defineProperty( "translationSnap", null );
|
|
defineProperty( "translationSnap", null );
|
|
defineProperty( "rotationSnap", null );
|
|
defineProperty( "rotationSnap", null );
|
|
|
|
+ defineProperty( "scaleSnap", null );
|
|
defineProperty( "space", "world" );
|
|
defineProperty( "space", "world" );
|
|
defineProperty( "size", 1 );
|
|
defineProperty( "size", 1 );
|
|
defineProperty( "dragging", false );
|
|
defineProperty( "dragging", false );
|
|
@@ -459,6 +460,28 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
|
|
|
object.scale.copy( scaleStart ).multiply( _tempVector2 );
|
|
object.scale.copy( scaleStart ).multiply( _tempVector2 );
|
|
|
|
|
|
|
|
+ if ( this.scaleSnap ) {
|
|
|
|
+
|
|
|
|
+ if ( axis.search( 'X' ) !== - 1 ) {
|
|
|
|
+
|
|
|
|
+ object.scale.x = Math.round( object.scale.x / this.scaleSnap ) * this.scaleSnap || this.scaleSnap;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ( axis.search( 'Y' ) !== - 1 ) {
|
|
|
|
+
|
|
|
|
+ object.scale.y = Math.round( object.scale.y / this.scaleSnap ) * this.scaleSnap || this.scaleSnap;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ( axis.search( 'Z' ) !== - 1 ) {
|
|
|
|
+
|
|
|
|
+ object.scale.z = Math.round( object.scale.z / this.scaleSnap ) * this.scaleSnap || this.scaleSnap;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
} else if ( mode === 'rotate' ) {
|
|
} else if ( mode === 'rotate' ) {
|
|
|
|
|
|
offset.copy( pointEnd ).sub( pointStart );
|
|
offset.copy( pointEnd ).sub( pointStart );
|
|
@@ -633,6 +656,12 @@ THREE.TransformControls = function ( camera, domElement ) {
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ this.setScaleSnap = function ( scaleSnap ) {
|
|
|
|
+
|
|
|
|
+ scope.scaleSnap = scaleSnap;
|
|
|
|
+
|
|
|
|
+ };
|
|
|
|
+
|
|
this.setSize = function ( size ) {
|
|
this.setSize = function ( size ) {
|
|
|
|
|
|
scope.size = size;
|
|
scope.size = size;
|