Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Touchpad-friently 3d navigation #4598

Merged
merged 5 commits into from
Apr 4, 2024

Conversation

buzzhuzz
Copy link
Contributor

Implement FreeCAD-inspired touchpad navigation mode.

This mode makes 3d model inspection easier for devices with touchpad as the only pointer device.

Controls:

  • Shift+move: panning
  • Alt+move: rotation

buzzhuzz and others added 3 commits March 20, 2024 17:53
Add camera navigation style config option as a preparation for
introduction of touchpad style 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.
@SoftFever SoftFever added this to the 2.1 milestone Mar 22, 2024
@SoftFever SoftFever added wait for response waiting for response from PR creator and removed wait for response waiting for response from PR creator labels Apr 3, 2024
@@ -4452,6 +4456,24 @@ void GLCanvas3D::on_set_focus(wxFocusEvent& evt)
m_tooltip_enabled = true;
}

bool GLCanvas3D::is_camera_rotate(const wxMouseEvent& evt) const
{
if (wxGetApp().app_config->get("camera_navigation_style") == "1") {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better to cache this value as member variable to avoid uncessary overhead as this is called in every mouse event.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated that code.

Now this setting is cached on canvas focus.

I've also added forced focus for the canvas on preferences window close. This helps to solve 2 things:

  1. Force update setting value (which also could be applied to "zoom_to_mouse", "reverse_mouse_wheel_zoom" and "use_free_camera")
  2. User could immediately use 3D view hotkeys without clicking on a view first.


bool GLCanvas3D::is_camera_pan(const wxMouseEvent& evt) const
{
if (wxGetApp().app_config->get("camera_navigation_style") == "1") {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

@SoftFever
Copy link
Owner

Works like a charm ;)

@buzzhuzz
Copy link
Contributor Author

buzzhuzz commented Apr 4, 2024

I made a screen cap which demonstrates this feature in action.

Default navigation mode:

nav-default2.mp4

"Touchpad" navigation mode:

nav-touchpad2.mp4

This navigation modes splits scene control over two hands making scene control easier for devices like touchpad or some trackballs.

Cache current navigation style on canvas focus, do not
request settings value each mouse event.
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.
Copy link
Owner

@SoftFever SoftFever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.
Thank you!

@SoftFever SoftFever merged commit 9d81245 into SoftFever:main Apr 4, 2024
11 of 12 checks passed
@buzzhuzz buzzhuzz deleted the touchpad-navigation branch April 4, 2024 14:21
powpingdone pushed a commit to powpingdone/OrcaSlicer that referenced this pull request Apr 10, 2024
* 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.
powpingdone pushed a commit to powpingdone/OrcaSlicer that referenced this pull request Apr 11, 2024
* 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.
SoftFever pushed a commit that referenced this pull request Apr 13, 2024
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants