Browse Source

Editor: Changed the snapping code for my own peace of mind :P

Mr.doob 12 years ago
parent
commit
69bc8aa04a
1 changed files with 3 additions and 3 deletions
  1. 3 3
      editor/js/ui/Viewport.js

+ 3 - 3
editor/js/ui/Viewport.js

@@ -148,9 +148,9 @@ var Viewport = function ( signals ) {
 			var point = intersects[ 0 ].point.sub( offset );
 			var point = intersects[ 0 ].point.sub( offset );
 
 
 			if (snapDist) {
 			if (snapDist) {
-				point.x = point.x - point.x % snapDist;
-				point.y = point.y - point.y % snapDist;
-				point.z = point.z - point.z % snapDist;
+				point.x = Math.round( point.x / snapDist ) * snapDist;
+				point.y = Math.round( point.y / snapDist ) * snapDist;
+				point.z = Math.round( point.z / snapDist ) * snapDist;
 			}
 			}
 
 
 			selected.position.x = modifierAxis.x === 1 ? point.x : intersectionPlane.position.x;
 			selected.position.x = modifierAxis.x === 1 ? point.x : intersectionPlane.position.x;