CQ-editor icon indicating copy to clipboard operation
CQ-editor copied to clipboard

View improvements

Open mbway opened this issue 4 years ago • 9 comments
trafficstars

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:

https://user-images.githubusercontent.com/4923501/105905691-aa72d280-601a-11eb-8d74-27950ab8658c.mp4

toolbar before and after:

toolbar_before

toolbar_after

mbway avatar Jan 26 '21 21:01 mbway

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 :warning:
cq_editor/main_window.py 55.55% 3 Missing and 1 partial :warning:
cq_editor/widgets/viewer.py 33.33% 3 Missing and 1 partial :warning:
cq_editor/__main__.py 50.00% 1 Missing :warning:
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     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jan 26 '21 21:01 codecov[bot]

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.

marcus7070 avatar Feb 18 '21 04:02 marcus7070

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?

mbway avatar Jun 19 '21 16:06 mbway

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

adam-urbanczyk avatar Jun 19 '21 17:06 adam-urbanczyk

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

mbway avatar Jun 19 '21 18:06 mbway

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.

adam-urbanczyk avatar Jun 19 '21 18:06 adam-urbanczyk

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

mbway avatar Jul 25 '21 17:07 mbway

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?

roel-v avatar Jan 12 '24 15:01 roel-v

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

mbway avatar Jan 12 '24 21:01 mbway