BoxHelper: More consistent API
@@ -54,10 +54,17 @@
<h2>Methods</h2>
<div>See the base [page:LineSegments] class for common methods.</div>
- <h3>[method:null update]( [page:Object3D object] )</h3>
+ <h3>[method:null update]()</h3>
<div>
- Updates the helper's geometry to match the dimensions of the
- of the passed object, including any children. See [page:Box3.setFromObject].
+ Updates the helper's geometry to match the dimensions
+ of the object, including any children. See [page:Box3.setFromObject].
+ </div>
+
+ <h3>[method:BoxHelper setFromObject]( [page:Object3D object] )</h3>
+ <div>
+ [page:Object3D object] - [page:Object3D] to create the helper of.<br /><br />
+ Updates the wireframe box for the passed object.
</div>
<h2>Source</h2>
@@ -60,7 +60,7 @@ var Viewport = function ( editor ) {
if ( object !== undefined ) {
- selectionBox.update( object );
+ selectionBox.setFromObject( object );
if ( editor.helpers[ object.id ] !== undefined ) {
@@ -385,7 +385,7 @@ var Viewport = function ( editor ) {
if ( box.isEmpty() === false ) {
- selectionBox.update( box );
selectionBox.visible = true;
}
@@ -408,7 +408,7 @@ var Viewport = function ( editor ) {
@@ -430,7 +430,7 @@ var Viewport = function ( editor ) {
if ( editor.selected === object ) {
transformControls.update();
@@ -6,10 +6,13 @@ import { BufferGeometry } from '../core/BufferGeometry';
/**
* @author mrdoob / http://mrdoob.com/
+ * @author Mugen87 / http://github.com/Mugen87
*/
function BoxHelper( object, color ) {
+ this.object = object;
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 ] );
@@ -21,11 +24,9 @@ function BoxHelper( object, color ) {
LineSegments.call( this, geometry, new LineBasicMaterial( { color: color } ) );
- if ( object !== undefined ) {
-
- this.update( object );
+ this.matrixAutoUpdate = false;
- }
+ this.update();
@@ -38,13 +39,15 @@ BoxHelper.prototype.update = ( function () {
return function update( object ) {
- if ( object && object.isBox3 ) {
+ if ( object !== undefined ) {
- box.copy( object );
+ console.warn( 'THREE.BoxHelper: .update() has no longer arguments.' );
+ }
- } else {
+ if ( this.object !== undefined ) {
- box.setFromObject( object );
+ box.setFromObject( this.object );
@@ -89,5 +92,14 @@ BoxHelper.prototype.update = ( function () {
} )();
+BoxHelper.prototype.setFromObject = function ( object ) {
+ return this;
+};
export { BoxHelper };