Add Tablet/Trackpad nav preset

This commit adds a new navigation preset called `Tablet/Trackpad` which enables "Emulate 3 Button Mouse" to more quickly set up good default keys for tablet users.

It also adds support for mouse buttons 4 and 5 in the navigation settings which will be helpful if users want to customize 3D navigation further for specific pens/mice.
This commit is contained in:
Matt Enad
2024-10-08 13:09:13 -04:00
parent 1f47e4c4e3
commit bd47e4f1ba
5 changed files with 49 additions and 12 deletions
+12
View File
@@ -2125,6 +2125,18 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
nav_mode = change_nav_from_shortcut;
}
} else if (m->get_button_mask().has_flag(MouseButtonMask::MB_XBUTTON1)) {
NavigationMode change_nav_from_shortcut = _get_nav_mode_from_shortcut_check(NAVIGATION_MOUSE_4, shortcut_check_sets, false);
if (change_nav_from_shortcut != NAVIGATION_NONE) {
nav_mode = change_nav_from_shortcut;
}
} else if (m->get_button_mask().has_flag(MouseButtonMask::MB_XBUTTON2)) {
NavigationMode change_nav_from_shortcut = _get_nav_mode_from_shortcut_check(NAVIGATION_MOUSE_5, shortcut_check_sets, false);
if (change_nav_from_shortcut != NAVIGATION_NONE) {
nav_mode = change_nav_from_shortcut;
}
} else if (EDITOR_GET("editors/3d/navigation/emulate_3_button_mouse")) {
// Handle trackpad (no external mouse) use case
NavigationMode change_nav_from_shortcut = _get_nav_mode_from_shortcut_check(NAVIGATION_LEFT_MOUSE, shortcut_check_sets, true);