Browse Source

Added double click to select selected item, instead of clicking to select button

rsredsq 10 years ago
parent
commit
5798a964c0
1 changed files with 18 additions and 13 deletions
  1. 18 13
      Script/AtomicEditor/ui/modal/ResourceSelection.ts

+ 18 - 13
Script/AtomicEditor/ui/modal/ResourceSelection.ts

@@ -56,24 +56,19 @@ class ResourceSelection extends ModalWindow {
 
     handleWidgetEvent(ev: Atomic.UIWidgetEvent) {
 
-        if (ev.type == Atomic.UI_EVENT_TYPE_CLICK) {
+        if(ev.count >= 2) {
+            var id = ev.target.id;
+            if(id == this.folderList.rootList.id) {
+                this.selectFile();
+            }
+        }
 
+        if (ev.type == Atomic.UI_EVENT_TYPE_CLICK) {
             var id = ev.target.id;
 
             if (id == "select") {
 
-                var id = this.folderList.selectedItemID;
-
-                if (id.length) {
-
-                  this.callback(ToolCore.assetDatabase.getAssetByGUID(id), this.args);
-
-                }
-
-
-                this.hide();
-
-                return true;
+                return this.selectFile();
 
             }
 
@@ -87,6 +82,16 @@ class ResourceSelection extends ModalWindow {
         }
 
     }
+
+    selectFile():boolean {
+        var id = this.folderList.selectedItemID;
+        if(id.length) {
+            this.callback(ToolCore.assetDatabase.getAssetByGUID(id), this.args);
+            this.hide();
+            return true;
+        }
+        return false;
+    }
 }