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

View improvements #220

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

View improvements #220

wants to merge 5 commits into from

Conversation

mbway
Copy link
Contributor

@mbway mbway commented Jan 26, 2021

Some changes to the 3D view that I find useful:

  • I changed view rotation to behave like blender in a way that I find much more usable. I'm not sure if the behaviour has a specific name, but I would describe it as 'orbit':
    • x movement rotates the view about the world z-axis passing through the point that the camera is looking at
    • y movement rotates the view about the local y-axis passing through the point that the camera is looking at
    • I find with the previous rotation handling, that it is very hard to look at something without the view being tilted in an undesirable way
    • I added an option in the preferences to switch between this mode and the original (with orbit set as default)
  • zoom handles scroll delta properly. This is especially important for laptop trackpads where wheel events are triggered even for tiny movements but with a small delta. Before the change the delta value was not taken into account which caused erratic zooming that was difficult to control.
  • the toolbar background color is set to grey so that the icons are more visible when a dark theme is used
    • another approach would be to create icons for dark mode but this is simpler
    • also set tooltip backgrounds to improve legibility
  • unrelated to the view, I added support for exiting the application with Ctrl+C

Demo of the new rotation behaviour:

orbit.mp4

toolbar before and after:

toolbar_before

toolbar_after

@codecov
Copy link

codecov bot commented Jan 26, 2021

Codecov Report

Attention: 31 lines in your changes are missing coverage. Please review.

Comparison is base (4ef178a) 88.60% compared to head (84968a9) 87.33%.

Files Patch % Lines
cq_editor/widgets/occt_widget.py 45.00% 20 Missing and 2 partials ⚠️
cq_editor/main_window.py 55.55% 3 Missing and 1 partial ⚠️
cq_editor/widgets/viewer.py 33.33% 3 Missing and 1 partial ⚠️
cq_editor/__main__.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #220      +/-   ##
==========================================
- Coverage   88.60%   87.33%   -1.27%     
==========================================
  Files          19       19              
  Lines        1553     1587      +34     
  Branches      189      196       +7     
==========================================
+ Hits         1376     1386      +10     
- Misses        143      163      +20     
- Partials       34       38       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marcus7070
Copy link
Member

I've pulled and built this. I'm a huge fan of that orbital movement! ctrl-c also works nice. I don't have a dark theme at hand so I didn't test that aspect.

@mbway
Copy link
Contributor Author

mbway commented Jun 19, 2021

I don't really mind that this hasn't been merged because I created this functionality for my own use as well, but is there a reason that no-one has looked at this for 5 months?

@adam-urbanczyk
Copy link
Member

Thanks for opening the PR. Lack of time / you want to change the default behavior without first discussing.

@mbway
Copy link
Contributor Author

mbway commented Jun 19, 2021

apologies if I didn't follow the correct procedure. I didn't see any instructions for contributors so I assumed any discussion would happen here. I'm fine with setting the original behaviour as the default, that would be trivial to change

@adam-urbanczyk
Copy link
Member

If you want to change something it is better to open an issue first. I'll try to take a look but TBH this is not the highest prio ATM and I'm rather conservative regarding adding new functionality/complicating the codebase.

BTW: The ctrl-c is stuff is definitely worth adding.

@mbway
Copy link
Contributor Author

mbway commented Jul 25, 2021

by the way, I found that FreeCAD calls this mode 'Turntable' (in preferences > Display > Navigation > Orbit Style)

@roel-v
Copy link
Contributor

roel-v commented Jan 12, 2024

Any chance this can be picked up again? I too find the default navigation behavior a lot more difficult to use than the way it works in Blender. I wanted to work on this myself but I'm quite happy to see there is already a patch. Should this maybe be split into separate pull requests for each of the issues it covers?

@mbway
Copy link
Contributor Author

mbway commented Jan 12, 2024

I haven't used CQ-editor in ages but I merged with master and renamed the setting to match blender terminology that I think was established after this PR, or maybe I just didn't find it before.

image

I haven't tested extensively but in a quick test everything seems to be working

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.

4 participants