06wj il y a 7 ans
Parent
commit
048d2606e5
1 fichiers modifiés avec 7 ajouts et 7 suppressions
  1. 7 7
      src/objects/Sprite.js

+ 7 - 7
src/objects/Sprite.js

@@ -32,7 +32,7 @@ Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
 		var intersectPoint = new Vector3();
 		var intersectPoint = new Vector3();
 		var worldPosition = new Vector3();
 		var worldPosition = new Vector3();
 		var worldScale = new Vector3();
 		var worldScale = new Vector3();
-		
+
 		var alignedPosition = new Vector2();
 		var alignedPosition = new Vector2();
 		var rotatedPosition = new Vector2();
 		var rotatedPosition = new Vector2();
 		var matrixWorldInverse = new Matrix4();
 		var matrixWorldInverse = new Matrix4();
@@ -42,19 +42,19 @@ Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
 			worldScale.setFromMatrixScale( this.matrixWorld );
 			worldScale.setFromMatrixScale( this.matrixWorld );
 
 
 			// compute position in camera space
 			// compute position in camera space
-			alignedPosition.set( ( 0.5 - this.center.x  ) * worldScale.x, ( 0.5 - this.center.y ) * worldScale.y );
-			
+			alignedPosition.set( ( 0.5 - this.center.x ) * worldScale.x, ( 0.5 - this.center.y ) * worldScale.y );
+
 			var rotation = this.material.rotation;
 			var rotation = this.material.rotation;
-			rotatedPosition.x = (Math.cos(rotation) * alignedPosition.x) - (Math.sin(rotation) * alignedPosition.y);
-			rotatedPosition.y = (Math.sin(rotation) * alignedPosition.x) + (Math.cos(rotation) * alignedPosition.y);
-			
+			rotatedPosition.x = ( Math.cos( rotation ) * alignedPosition.x ) - ( Math.sin( rotation ) * alignedPosition.y );
+			rotatedPosition.y = ( Math.sin( rotation ) * alignedPosition.x ) + ( Math.cos( rotation ) * alignedPosition.y );
+
 			worldPosition.setFromMatrixPosition( this.modelViewMatrix );
 			worldPosition.setFromMatrixPosition( this.modelViewMatrix );
 			worldPosition.x += rotatedPosition.x;
 			worldPosition.x += rotatedPosition.x;
 			worldPosition.y += rotatedPosition.y;
 			worldPosition.y += rotatedPosition.y;
 
 
 			// transform to world space
 			// transform to world space
 			worldPosition.applyMatrix4( matrixWorldInverse.getInverse( this.modelViewMatrix ) ).applyMatrix4( this.matrixWorld );
 			worldPosition.applyMatrix4( matrixWorldInverse.getInverse( this.modelViewMatrix ) ).applyMatrix4( this.matrixWorld );
-			
+
 			raycaster.ray.closestPointToPoint( worldPosition, intersectPoint );
 			raycaster.ray.closestPointToPoint( worldPosition, intersectPoint );
 
 
 			var guessSizeSq = worldScale.x * worldScale.y / 4;
 			var guessSizeSq = worldScale.x * worldScale.y / 4;