Browse Source

Editor: Fancier outliner.

Mr.doob 12 years ago
parent
commit
328834506e
3 changed files with 16 additions and 26 deletions
  1. 0 18
      editor/index.html
  2. 15 7
      editor/js/UI.js
  3. 1 1
      editor/js/ui/Sidebar.Outliner.js

+ 0 - 18
editor/index.html

@@ -15,24 +15,6 @@
 				border-top: 1px solid #ccc;
 				border-top: 1px solid #ccc;
 			}
 			}
 
 
-			.fancy_select {
-				background: #fff;
-				border: 1px solid #ccc;
-				padding: 0;
-				cursor: default;
-				overflow: auto;
-			}
-
-			.option_item {
-				padding: 0 0.25em;
-			}
-
-			.option_selected {
-				background: #000;
-				color: #fff;
-			}
-
-			.object_type { color: #aaa }
 		</style>
 		</style>
 	</head>
 	</head>
 	<body>
 	<body>

+ 15 - 7
editor/js/UI.js

@@ -414,9 +414,15 @@ UI.FancySelect = function ( position ) {
 
 
 	var scope = this;
 	var scope = this;
 
 
-	this.dom = document.createElement( 'div' );
-	this.dom.className = "fancy_select";
-	this.dom.style.position = position || 'relative';
+	var dom = document.createElement( 'div' );
+	dom.style.position = position || 'relative';
+	dom.style.background = '#fff';
+	dom.style.border = '1px solid #ccc';
+	dom.style.padding = '0';
+	dom.style.cursor = 'default';
+	dom.style.overflow = 'auto';
+
+	this.dom = dom;
 
 
 	this.onChangeCallback = null;
 	this.onChangeCallback = null;
 
 
@@ -447,11 +453,11 @@ UI.FancySelect.prototype.setOptions = function ( options ) {
 
 
 			for ( var i = 0; i < scope.options.length; i ++ ) {
 			for ( var i = 0; i < scope.options.length; i ++ ) {
 
 
-				scope.options[ i ].className = "";
+				scope.options[ i ].style.backgroundColor = '#f0f0f0';
 
 
 			}
 			}
 
 
-			element.className = "option_selected";
+			element.style.backgroundColor = '#f0f0f0';
 
 
 			scope.selectedValue = value;
 			scope.selectedValue = value;
 
 
@@ -464,6 +470,8 @@ UI.FancySelect.prototype.setOptions = function ( options ) {
 	for ( var key in options ) {
 	for ( var key in options ) {
 
 
 		var option = document.createElement( 'div' );
 		var option = document.createElement( 'div' );
+		option.style.padding = '4px';
+		option.style.whiteSpace = 'nowrap';
 		option.innerHTML = options[ key ];
 		option.innerHTML = options[ key ];
 		option.value = key;
 		option.value = key;
 		scope.dom.appendChild( option );
 		scope.dom.appendChild( option );
@@ -496,11 +504,11 @@ UI.FancySelect.prototype.setValue = function ( value ) {
 
 
 		if ( element.value === key ) {
 		if ( element.value === key ) {
 
 
-			element.className = "option_selected";
+			element.style.backgroundColor = '#f0f0f0';
 
 
 		} else {
 		} else {
 
 
-			element.className = "";
+			element.style.backgroundColor = '';
 
 
 		}
 		}
 
 

+ 1 - 1
editor/js/ui/Sidebar.Outliner.js

@@ -75,7 +75,7 @@ Sidebar.Outliner = function ( signals ) {
 
 
 				var child = object.children[ key ];
 				var child = object.children[ key ];
 
 
-				options[ child.id ] = '<div class="option_item">' + pad + '+ ' + child.name + ' <span class="object_type">[' + getObjectType( child ) + ']</span></div>';
+				options[ child.id ] = pad + child.name + ' <span style="color: #aaa">- ' + getObjectType( child ) + '</span>';
 
 
 				createList( child, pad + '&nbsp;&nbsp;&nbsp;' );
 				createList( child, pad + '&nbsp;&nbsp;&nbsp;' );