Browse Source

Editor: Prettier Shadow panel.

Mr.doob 9 years ago
parent
commit
593102b1df
2 changed files with 34 additions and 10 deletions
  1. 16 10
      editor/js/Sidebar.Object3D.js
  2. 18 0
      editor/js/libs/ui.js

+ 16 - 10
editor/js/Sidebar.Object3D.js

@@ -247,21 +247,27 @@ Sidebar.Object3D = function ( editor ) {
 
 	// shadow
 
-	var objectCastShadowRow = new UI.Panel();
+	var objectShadowRow = new UI.Panel();
+
+	objectShadowRow.add( new UI.Text( 'Shadow' ).setWidth( '90px' ) );
+
+	var objectCastShadowSpan = new UI.Span();
 	var objectCastShadow = new UI.Checkbox().onChange( update );
 
-	objectCastShadowRow.add( new UI.Text( 'Cast Shadow' ).setWidth( '90px' ) );
-	objectCastShadowRow.add( objectCastShadow );
+	objectCastShadowSpan.add( objectCastShadow );
+	objectCastShadowSpan.add( new UI.Text( 'cast' ).setMarginRight( '10px' ) );
 
-	container.add( objectCastShadowRow );
+	objectShadowRow.add( objectCastShadowSpan );
 
-	var objectReceiveShadowRow = new UI.Panel();
+	var objectReceiveShadowSpan = new UI.Span();
 	var objectReceiveShadow = new UI.Checkbox().onChange( update );
 
-	objectReceiveShadowRow.add( new UI.Text( 'Receive Shad' ).setWidth( '90px' ) );
-	objectReceiveShadowRow.add( objectReceiveShadow );
+	objectReceiveShadowSpan.add( objectReceiveShadow );
+	objectReceiveShadowSpan.add( new UI.Text( 'receive' ) );
+
+	objectShadowRow.add( objectReceiveShadowSpan );
 
-	container.add( objectReceiveShadowRow );
+	container.add( objectShadowRow );
 
 	// visible
 
@@ -493,8 +499,8 @@ Sidebar.Object3D = function ( editor ) {
 			'angle' : objectAngleRow,
 			'exponent' : objectExponentRow,
 			'decay' : objectDecayRow,
-			'castShadow' : objectCastShadowRow,
-			'receiveShadow' : objectReceiveShadowRow
+			'castShadow' : objectShadowRow,
+			'receiveShadow' : objectReceiveShadowSpan
 		};
 
 		for ( var property in properties ) {

+ 18 - 0
editor/js/libs/ui.js

@@ -90,6 +90,8 @@ UI.Element.prototype = {
 
 		}
 
+		return this;
+
 	},
 
 	setDisabled: function ( value ) {
@@ -123,6 +125,7 @@ properties.forEach( function ( property ) {
 	UI.Element.prototype[ method ] = function () {
 
 		this.setStyle( property, arguments );
+
 		return this;
 
 	};
@@ -147,6 +150,21 @@ events.forEach( function ( event ) {
 
 } );
 
+// Span
+
+UI.Span = function () {
+
+	UI.Element.call( this );
+
+	this.dom = document.createElement( 'span' );
+
+	return this;
+
+};
+
+UI.Span.prototype = Object.create( UI.Element.prototype );
+UI.Span.prototype.constructor = UI.Span;
+
 
 // Panel