Browse Source

Use arrows keys to navigate in hierarchy and project panels

rsredsq 10 years ago
parent
commit
4ec173d0e7

+ 10 - 0
Script/AtomicEditor/ui/frames/HierarchyFrame.ts

@@ -197,6 +197,16 @@ class HierarchyFrame extends Atomic.UIWidget {
 
         if (data.type == Atomic.UI_EVENT_TYPE_KEY_UP) {
 
+            if (data.key == Atomic.KEY_DOWN || data.key == Atomic.KEY_UP) {
+                var selectedId = Number(this.hierList.selectedItemID);
+                var node = this.scene.getNode(selectedId);
+
+                if (node) {
+
+                    this.sendEvent("EditorActiveNodeChange", { node: node });
+
+                }
+            }
             // node deletion
             if (data.key == Atomic.KEY_DELETE || data.key == Atomic.KEY_BACKSPACE) {
 

+ 16 - 0
Script/AtomicEditor/ui/frames/ProjectFrame.ts

@@ -136,6 +136,22 @@ class ProjectFrame extends ScriptWidget {
 
     handleWidgetEvent(data: Atomic.UIWidgetEvent): boolean {
 
+        if (data.type == Atomic.UI_EVENT_TYPE_KEY_UP) {
+
+            if (data.key == Atomic.KEY_DOWN || data.key == Atomic.KEY_UP) {
+
+                var selectedId = this.folderList.selectedItemID;
+
+                if (selectedId != "0") {
+                    var db = ToolCore.getAssetDatabase();
+
+                    var asset = db.getAssetByGUID(selectedId);
+
+                    if (asset.isFolder)
+                        this.refreshContent(asset);
+                }
+            }
+        }
         if (data.type == Atomic.UI_EVENT_TYPE_RIGHT_POINTER_UP) {
 
             var id = data.target.id;

+ 1 - 1
Source/Atomic/UI/UIInput.cpp

@@ -427,7 +427,7 @@ void UI::HandleKey(bool keydown, int keycode, int scancode)
     }
     else
     {
-        InvokeKey(this, rootWidget_, 0, specialKey, mod, keydown);
+        InvokeKey(this, rootWidget_, keycode, specialKey, mod, keydown);
     }
 
 }

+ 0 - 1
Source/Atomic/UI/UIListView.cpp

@@ -230,7 +230,6 @@ ListViewItemWidget::ListViewItemWidget(ListViewItem *item, ListViewItemSource *s
     SetLayoutDistribution(LAYOUT_DISTRIBUTION_GRAVITY);
     SetLayoutDistributionPosition(LAYOUT_DISTRIBUTION_POSITION_LEFT_TOP);
     SetPaintOverflowFadeout(false);
-    SetCapturing(false);
 
     item_->widget_ = this;