浏览代码

Editor: Fixed outliner not reatining the selected object.

Mr.doob 12 年之前
父节点
当前提交
9a074e3510
共有 2 个文件被更改,包括 7 次插入7 次删除
  1. 6 1
      editor/js/Sidebar.Scene.js
  2. 1 6
      editor/js/libs/ui.js

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

@@ -156,6 +156,8 @@ Sidebar.Scene = function ( signals ) {
 
 	// events
 
+	var selected;
+
 	signals.sceneChanged.add( function ( object ) {
 
 		scene = object;
@@ -179,6 +181,7 @@ Sidebar.Scene = function ( signals ) {
 		} )( scene.children, '   ' );
 
 		outliner.setOptions( options );
+		outliner.setValue( selected );
 
 		if ( scene.fog ) {
 
@@ -209,7 +212,9 @@ Sidebar.Scene = function ( signals ) {
 
 	signals.objectSelected.add( function ( object ) {
 
-		outliner.setValue( object !== null ? object.id : null );
+		selected = object !== null ? object.id : null;
+
+		outliner.setValue( selected );
 
 	} );
 

+ 1 - 6
editor/js/libs/ui.js

@@ -401,16 +401,11 @@ UI.FancySelect.prototype.getValue = function () {
 
 UI.FancySelect.prototype.setValue = function ( value ) {
 
-	// must convert raw value into string for compatibility with UI.Select
-	// which uses string values (initialized from options keys)
-
-	var key = value ? value.toString() : value;
-
 	for ( var i = 0; i < this.options.length; i ++ ) {
 
 		var element = this.options[ i ];
 
-		if ( element.value === key ) {
+		if ( element.value === value ) {
 
 			element.style.backgroundColor = '#f0f0f0';