From 584a9a3c985c05704335e0deab4d5baeadd6781a Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Mon, 23 Jan 2017 15:22:49 -0800 Subject: [PATCH] UI navigation work with game pads The tablet UI can be long lived, unlike the previous VRMenu. So instead of using a dynamic mapping that was only enabled when the VRMenu was shown, standard_navigation.json. standard_navigation is always active. Also, standard_navigation.json has been changed. Left and Right click and stick events never become UINav events. Only Dpad A, B, X, Y, LB and RB are mapped to UINav events. --- .../controllers/standard_navigation.json | 40 +------------------ .../qml/hifi/tablet/TabletMouseHandler.qml | 2 - .../resources/qml/hifi/tablet/TabletRoot.qml | 3 -- interface/src/Application.cpp | 2 +- 4 files changed, 3 insertions(+), 44 deletions(-) diff --git a/interface/resources/controllers/standard_navigation.json b/interface/resources/controllers/standard_navigation.json index 81096a7230..36cab8be8f 100644 --- a/interface/resources/controllers/standard_navigation.json +++ b/interface/resources/controllers/standard_navigation.json @@ -1,6 +1,5 @@ { - "name": "Standard to Action", - "when": "Application.NavigationFocused", + "name": "Standard to UI Navigation Action", "channels": [ { "from": "Standard.DU", "to": "Actions.UiNavVertical" }, { "from": "Standard.DD", "to": "Actions.UiNavVertical", "filters": "invert" }, @@ -9,42 +8,7 @@ { "from": "Standard.LB", "to": "Actions.UiNavGroup","filters": "invert" }, { "from": "Standard.RB", "to": "Actions.UiNavGroup" }, { "from": [ "Standard.A", "Standard.X" ], "to": "Actions.UiNavSelect" }, - { "from": [ "Standard.B", "Standard.Y" ], "to": "Actions.UiNavBack" }, - { "from": [ "Standard.RTClick", "Standard.LTClick" ], "to": "Actions.UiNavSelect" }, - { - "from": "Standard.LX", "to": "Actions.UiNavLateral", - "filters": [ - { "type": "deadZone", "min": 0.95 }, - "constrainToInteger", - { "type": "pulse", "interval": 0.4 } - ] - }, - { - "from": "Standard.LY", "to": "Actions.UiNavVertical", - "filters": [ - "invert", - { "type": "deadZone", "min": 0.95 }, - "constrainToInteger", - { "type": "pulse", "interval": 0.4 } - ] - }, - { - "from": "Standard.RX", "to": "Actions.UiNavLateral", - "filters": [ - { "type": "deadZone", "min": 0.95 }, - "constrainToInteger", - { "type": "pulse", "interval": 0.4 } - ] - }, - { - "from": "Standard.RY", "to": "Actions.UiNavVertical", - "filters": [ - "invert", - { "type": "deadZone", "min": 0.95 }, - "constrainToInteger", - { "type": "pulse", "interval": 0.4 } - ] - } + { "from": [ "Standard.B", "Standard.Y" ], "to": "Actions.UiNavBack" } ] } diff --git a/interface/resources/qml/hifi/tablet/TabletMouseHandler.qml b/interface/resources/qml/hifi/tablet/TabletMouseHandler.qml index 52fcdaf6ce..8b1a62e0ed 100644 --- a/interface/resources/qml/hifi/tablet/TabletMouseHandler.qml +++ b/interface/resources/qml/hifi/tablet/TabletMouseHandler.qml @@ -90,7 +90,6 @@ Item { } else { breadcrumbText.text = "Menu"; topMenu = null; - offscreenFlags.navigationFocused = false; } } @@ -99,7 +98,6 @@ Item { topMenu = newMenu; topMenu.focus = true; topMenu.forceActiveFocus(); - offscreenFlags.navigationFocused = true; } function clearMenus() { diff --git a/interface/resources/qml/hifi/tablet/TabletRoot.qml b/interface/resources/qml/hifi/tablet/TabletRoot.qml index 57c3424d78..8e524761c0 100644 --- a/interface/resources/qml/hifi/tablet/TabletRoot.qml +++ b/interface/resources/qml/hifi/tablet/TabletRoot.qml @@ -46,11 +46,8 @@ Item { }); } loader.item.forceActiveFocus(); - offscreenFlags.navigationFocused = true; } } - - Component.onDestruction: { offscreenFlags.navigationFocused = false; } width: 480 height: 720 diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index f6bcf591fc..3f19a638a0 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -978,7 +978,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo using namespace controller; auto offscreenUi = DependencyManager::get(); auto tabletScriptingInterface = DependencyManager::get(); - if (offscreenUi->navigationFocused()) { + { auto actionEnum = static_cast(action); int key = Qt::Key_unknown; static int lastKey = Qt::Key_unknown;