فهرست منبع

Editor: Improved selectionBox.

Mr.doob 9 سال پیش
والد
کامیت
33a53949a0
2فایلهای تغییر یافته به همراه7 افزوده شده و 3 حذف شده
  1. 6 2
      editor/js/Viewport.js
  2. 1 1
      src/extras/helpers/BoxHelper.js

+ 6 - 2
editor/js/Viewport.js

@@ -28,6 +28,8 @@ var Viewport = function ( editor ) {
 
 	//
 
+	var box = new THREE.Box3();
+
 	var selectionBox = new THREE.BoxHelper();
 	selectionBox.material.depthTest = false;
 	selectionBox.material.transparent = true;
@@ -364,9 +366,11 @@ var Viewport = function ( editor ) {
 
 		if ( object !== null ) {
 
-			if ( object.geometry !== undefined ) {
+			box.setFromObject( object );
+
+			if ( box.isEmpty() === false ) {
 
-				selectionBox.update( object );
+				selectionBox.update( box );
 				selectionBox.visible = true;
 
 			}

+ 1 - 1
src/extras/helpers/BoxHelper.js

@@ -3,7 +3,7 @@
  */
 
 THREE.BoxHelper = function ( object, color ) {
-	
+
 	if ( color === undefined ) color = 0xffff00;
 
 	var indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );