mirror of
https://github.com/godotengine/godot.git
synced 2024-11-12 23:24:26 +00:00
Fix Emulate 3 Button Mouse behavior in 3D viewport
This commit is contained in:
parent
99a7a9ccd6
commit
657221ba24
@ -344,7 +344,7 @@
|
||||
</member>
|
||||
<member name="editors/3d/navigation/emulate_3_button_mouse" type="bool" setter="" getter="">
|
||||
If [code]true[/code], enables 3-button mouse emulation mode. This is useful on laptops when using a trackpad.
|
||||
When 3-button mouse emulation mode is enabled, the pan, zoom and orbit modifiers can always be used in the 3D editor viewport, even when not holding down any mouse button.
|
||||
When 3-button mouse emulation mode is enabled, the pan, zoom and orbit modifiers can be used in the 3D editor viewport when holding [kbd]Alt[/kbd], even when not holding down any mouse button.
|
||||
</member>
|
||||
<member name="editors/3d/navigation/emulate_numpad" type="bool" setter="" getter="">
|
||||
If [code]true[/code], allows using the top row [kbd]0[/kbd]-[kbd]9[/kbd] keys to function as their equivalent numpad keys for 3D editor navigation. This should be enabled on keyboards that have no numeric keypad available.
|
||||
|
@ -2124,9 +2124,16 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
||||
|
||||
} 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);
|
||||
if (change_nav_from_shortcut != NAVIGATION_NONE) {
|
||||
nav_mode = change_nav_from_shortcut;
|
||||
// Check if the Alt key is pressed.
|
||||
if (Input::get_singleton()->is_key_pressed(Key::ALT)) {
|
||||
// Emulate the middle mouse button (Mouse3) with Alt for orbiting.
|
||||
NavigationMode change_nav_from_shortcut = _get_nav_mode_from_shortcut_check(NAVIGATION_LEFT_MOUSE, shortcut_check_sets, true);
|
||||
if (change_nav_from_shortcut != NAVIGATION_NONE) {
|
||||
nav_mode = change_nav_from_shortcut;
|
||||
}
|
||||
} else {
|
||||
// Regular behavior when Alt is not pressed, fallback to no navigation (NAVIGATION_NONE).
|
||||
nav_mode = NAVIGATION_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user