Explorar o código

Editor: Fixed duplicate FancySelect.setValue calls. Fixes #3907 and #4698.

Mr.doob %!s(int64=11) %!d(string=hai) anos
pai
achega
b179c5c5ca
Modificáronse 2 ficheiros con 9 adicións e 1 borrados
  1. 8 0
      editor/js/Sidebar.Scene.js
  2. 1 1
      editor/js/libs/ui.js

+ 8 - 0
editor/js/Sidebar.Scene.js

@@ -7,11 +7,17 @@ Sidebar.Scene = function ( editor ) {
 	container.addStatic( new UI.Text( 'SCENE' ) );
 	container.add( new UI.Break() );
 
+	var ignoreObjectSelectedSignal = false;
+
 	var outliner = new UI.FancySelect().setId( 'outliner' );
 	outliner.onChange( function () {
 
+		ignoreObjectSelectedSignal = true;
+
 		editor.selectById( parseInt( outliner.getValue() ) );
 
+		ignoreObjectSelectedSignal = false;
+
 	} );
 	container.add( outliner );
 	container.add( new UI.Break() );
@@ -194,6 +200,8 @@ Sidebar.Scene = function ( editor ) {
 
 	signals.objectSelected.add( function ( object ) {
 
+		if ( ignoreObjectSelectedSignal === true ) return;
+
 		outliner.setValue( object !== null ? object.id : null );
 
 	} );

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

@@ -495,13 +495,13 @@ UI.FancySelect = function () {
 					// Highlight selected dom elem and scroll parent if needed
 					scope.setValue( scope.options[ scope.selectedIndex ].value );
 
-					// Invoke object/helper/mesh selection logic
 					scope.dom.dispatchEvent( changeEvent );
 
 				}
 
 				break;
 		}
+
 	}, false);
 
 	this.dom = dom;