Browse Source

GUI: Added UI.setDisplay(). Showing/hidding properties panel when needed.

Mr.doob 13 years ago
parent
commit
147908be42
2 changed files with 16 additions and 0 deletions
  1. 9 0
      gui/js/UI.js
  2. 7 0
      gui/js/ui/SideBar.Properties.js

+ 9 - 0
gui/js/UI.js

@@ -134,6 +134,8 @@ UI.Element.prototype = {
 
 
 	},
 	},
 
 
+	//
+
 	setColor: function () {
 	setColor: function () {
 
 
 		this.setStyle( 'color', arguments );
 		this.setStyle( 'color', arguments );
@@ -146,6 +148,13 @@ UI.Element.prototype = {
 		this.setStyle( 'backgroundColor', arguments );
 		this.setStyle( 'backgroundColor', arguments );
 		return this;
 		return this;
 
 
+	},
+
+	setDisplay: function () {
+
+		this.setStyle( 'display', arguments );
+		return this;
+
 	}
 	}
 
 
 }
 }

+ 7 - 0
gui/js/ui/SideBar.Properties.js

@@ -3,6 +3,7 @@ var Properties = function ( signals ) {
 	var selected = null;
 	var selected = null;
 
 
 	var container = new UI.Panel();
 	var container = new UI.Panel();
+	container.setDisplay( 'none' );
 	container.setPadding( '8px' );
 	container.setPadding( '8px' );
 	container.setBorderTop( '1px solid #ccc' );
 	container.setBorderTop( '1px solid #ccc' );
 
 
@@ -85,6 +86,8 @@ var Properties = function ( signals ) {
 
 
 		if ( object ) {
 		if ( object ) {
 
 
+			container.setDisplay( 'block' );
+
 			positionX.setValue( object.position.x );
 			positionX.setValue( object.position.x );
 			positionY.setValue( object.position.y );
 			positionY.setValue( object.position.y );
 			positionZ.setValue( object.position.z );
 			positionZ.setValue( object.position.z );
@@ -97,6 +100,10 @@ var Properties = function ( signals ) {
 			scaleY.setValue( object.scale.y );
 			scaleY.setValue( object.scale.y );
 			scaleZ.setValue( object.scale.z );
 			scaleZ.setValue( object.scale.z );
 
 
+		} else {
+
+			container.setDisplay( 'none' );
+
 		}
 		}
 
 
 	} );
 	} );