Browse Source

Improved robustness when view closer

SuperWangKai 8 years ago
parent
commit
395651fafd
2 changed files with 5 additions and 1 deletions
  1. 2 1
      bin/Data/Scripts/Editor/EditorScene.as
  2. 3 0
      bin/Data/Scripts/Editor/EditorView.as

+ 2 - 1
bin/Data/Scripts/Editor/EditorScene.as

@@ -911,7 +911,8 @@ bool SceneSmartDuplicateNode()
 
 bool ViewCloser()
 {
-    LocateNodesAndComponents(selectedNodes, selectedComponents);
+    if (selectedNodes.length > 0 || selectedNodes.length > 0)
+        LocateNodesAndComponents(selectedNodes, selectedComponents);
     
     return true;
 }

+ 3 - 0
bin/Data/Scripts/Editor/EditorView.as

@@ -2596,6 +2596,9 @@ void LocateComponents(Array<Component@> components)
 
 void LocateNodesAndComponents(Array<Node@> nodes, Array<Component@> components)
 {
+    if (nodes.length == 0 && components.length == 0)
+        return;
+        
     // Calculate bounding box of all nodes
     BoundingBox box;
     Array<Component@> visitedComponents;