Touchpad-friently 3d navigation (#4598)

* gui: camera navigation style option

Add camera navigation style config option as a preparation for
introduction of touchpad style navigation

* gui: touchpa-friently 3d navigation

Implement FreeCAD-inspired touchpad-friendly camera operation mode:
- Shift+move: panning
- Alt+move: rotation

Set "Camera mode" to "Touchpad" in settings menu to activate this mode.

* cache current navigation style in class member variable

Cache current navigation style on canvas focus, do not
request settings value each mouse event.

* force focuse 3d preview on preferences window close

Explicitly force focus 3D preview pane on closing preferences window.
This allows preferences be updated only once without checking current
value each input event.
Another benefit is to have 3D view in focus is that user could
immediatelly use 3d-view shortcuts like Ctrl+<1..7> without clicking to
the 3D view first.
This commit is contained in:
Dima Buzdyk
2024-04-04 18:46:14 +05:00
committed by GitHub
parent 1dc9caf19d
commit 9d81245eff
6 changed files with 46 additions and 5 deletions

View File

@@ -551,6 +551,8 @@ private:
std::array<unsigned int, 2> m_old_size{ 0, 0 };
bool m_is_touchpad_navigation{ false };
// Screen is only refreshed from the OnIdle handler if it is dirty.
bool m_dirty;
bool m_initialized;
@@ -564,6 +566,7 @@ private:
bool m_multisample_allowed;
bool m_moving;
bool m_tab_down;
bool m_camera_movement;
//BBS: add toolpath outside
bool m_toolpath_outside{ false };
ECursorType m_cursor_type;
@@ -963,6 +966,9 @@ public:
void on_set_focus(wxFocusEvent& evt);
void force_set_focus();
bool is_camera_rotate(const wxMouseEvent& evt) const;
bool is_camera_pan(const wxMouseEvent& evt) const;
Size get_canvas_size() const;
Vec2d get_local_mouse_position() const;