浏览代码

Editor: Extracting FancySelect styles to template

jlewin 12 年之前
父节点
当前提交
b633ac0b54
共有 3 个文件被更改,包括 23 次插入10 次删除
  1. 20 1
      editor/index.html
  2. 1 1
      editor/js/Sidebar.Scene.js
  3. 2 8
      editor/js/libs/ui.js

+ 20 - 1
editor/index.html

@@ -83,7 +83,6 @@
 				overflow: auto;
 				overflow: auto;
 			}
 			}
 
 
-
 				#sidebar .Panel {
 				#sidebar .Panel {
 					margin-bottom: 10px;
 					margin-bottom: 10px;
 				}
 				}
@@ -94,6 +93,13 @@
 					border-top: 1px solid #333;
 					border-top: 1px solid #333;
 				}
 				}
 
 
+				#sidebar #outliner {
+					width: 100%;
+					height: 140px;
+					color: #444;
+					font-size: 12px;
+				}
+
 				#sidebar #outliner .type {
 				#sidebar #outliner .type {
 					padding: 2px 4px;
 					padding: 2px 4px;
 					font-size: 10px;
 					font-size: 10px;
@@ -116,6 +122,19 @@
 					margin-right: 6px;
 					margin-right: 6px;
 				}
 				}
 
 
+			.FancySelect {
+				background: #fff;
+				border: 1px solid #ccc;
+				padding: 0;
+				cursor: default;
+				overflow: auto;
+			}
+
+				.FancySelect .option {
+					padding: 4px;
+					white-space: nowrap;
+				}
+
 		</style>
 		</style>
 	</head>
 	</head>
 	<body>
 	<body>

+ 1 - 1
editor/js/Sidebar.Scene.js

@@ -7,7 +7,7 @@ Sidebar.Scene = function ( editor ) {
 	container.add( new UI.Text( 'SCENE' ) );
 	container.add( new UI.Text( 'SCENE' ) );
 	container.add( new UI.Break(), new UI.Break() );
 	container.add( new UI.Break(), new UI.Break() );
 
 
-	var outliner = new UI.FancySelect().setId( 'outliner' ).setWidth( '100%' ).setHeight('140px').setColor( '#444' ).setFontSize( '12px' );
+	var outliner = new UI.FancySelect().setId( 'outliner' );
 	outliner.onChange( function () {
 	outliner.onChange( function () {
 
 
 		editor.selectById( parseInt( outliner.getValue() ) );
 		editor.selectById( parseInt( outliner.getValue() ) );

+ 2 - 8
editor/js/libs/ui.js

@@ -354,11 +354,6 @@ UI.FancySelect = function () {
 
 
 	var dom = document.createElement( 'div' );
 	var dom = document.createElement( 'div' );
 	dom.className = 'FancySelect';
 	dom.className = 'FancySelect';
-	dom.style.background = '#fff';
-	dom.style.border = '1px solid #ccc';
-	dom.style.padding = '0';
-	dom.style.cursor = 'default';
-	dom.style.overflow = 'auto';
 	dom.tabIndex = 0;	// keyup event is ignored without setting tabIndex
 	dom.tabIndex = 0;	// keyup event is ignored without setting tabIndex
 
 
 	// Broadcast for object selection after arrow navigation
 	// Broadcast for object selection after arrow navigation
@@ -429,9 +424,8 @@ UI.FancySelect.prototype.setOptions = function ( options ) {
 
 
 	for ( var key in options ) {
 	for ( var key in options ) {
 
 
-		var option = document.createElement( 'div' );
-		option.style.padding = '4px';
-		option.style.whiteSpace = 'nowrap';
+		var option = document.createElement('div');
+		option.className = 'option';
 		option.innerHTML = options[ key ];
 		option.innerHTML = options[ key ];
 		option.value = key;
 		option.value = key;
 		scope.dom.appendChild( option );
 		scope.dom.appendChild( option );