diff options
author | sunnystormy <michael.brodeur@unseen.is> | 2016-04-06 02:15:34 -0400 |
---|---|---|
committer | RĂ©mi Verschelde <remi@verschelde.fr> | 2016-04-06 08:15:34 +0200 |
commit | 3ebde34d8fbcce5796b7bac6f26c9cf7881b55ad (patch) | |
tree | 3947dfb89df6b80eca078b5ab3ab4564c06ab225 /tools | |
parent | 868872392379aa5c90c3d199a2cfee32b8f593f2 (diff) |
Added rotation/panning support for trackpads in 3D mode #53
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/plugins/spatial_editor_plugin.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 79ff78ca0d..13b47f9fd3 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -819,7 +819,6 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { } } - switch(p_event.type) { case InputEvent::MOUSE_BUTTON: { @@ -1204,11 +1203,9 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { } } break; case InputEvent::MOUSE_MOTION: { - const InputEventMouseMotion &m=p_event.mouse_motion; _edit.mouse_pos=Point2(p_event.mouse_motion.x,p_event.mouse_motion.y); - - + if (spatial_editor->get_selected()) { @@ -1244,7 +1241,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { NavigationScheme nav_scheme = _get_navigation_schema("3d_editor/navigation_scheme"); NavigationMode nav_mode = NAVIGATION_NONE; - + if (_edit.gizmo.is_valid()) { Plane plane=Plane(_edit.gizmo_initial_pos,_get_camera_normal()); @@ -1558,6 +1555,26 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { if (m.mod.alt) nav_mode = NAVIGATION_PAN; } + }else{ + // Handle trackpad (no external mouse) use case + int mod = 0; + if (m.mod.shift) + mod=KEY_SHIFT; + if (m.mod.alt) + mod=KEY_ALT; + if (m.mod.control) + mod=KEY_CONTROL; + if (m.mod.meta) + mod=KEY_META; + + if(mod){ + if (mod == _get_key_modifier("3d_editor/pan_modifier")) + nav_mode = NAVIGATION_PAN; + else if (mod == _get_key_modifier("3d_editor/zoom_modifier")) + nav_mode = NAVIGATION_ZOOM; + else if (mod == _get_key_modifier("3d_editor/orbit_modifier")) + nav_mode = NAVIGATION_ORBIT; + } } switch(nav_mode) { |