-
-
Notifications
You must be signed in to change notification settings - Fork 963
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
gui: fix zoom-to-mouse #4844
gui: fix zoom-to-mouse #4844
Conversation
I've only tested Linux build on a 1920x1280 and 3840x2560 screens with several window sizes. Needed some additional testing on a variety of screens and platforms. |
src/slic3r/GUI/GLCanvas3D.cpp
Outdated
bool zoom_to_mouse = wxGetApp().app_config->get("zoom_to_mouse") == "true"; | ||
if (!zoom_to_mouse) {// zoom to center | ||
|
||
if (!zoom_to_mouse || !displacement.allFinite() || displacement.maxCoeff() > 1000 || displacement.minCoeff() < -1000) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't like compare value twice, but I couldn't find better way to check absolute value limits.
First of all: Thank you so much for taking this on! 👍Unfortunately the setup
|
@buzzhuzz Thank you so much! Your build works correctly in my case. macOS Sonoma 14.4.1 (23E224) on MacMini 2023 Apple M2 Pro. Registrazione.schermo.2024-04-02.alle.22.47.27.mp4 |
This is intentional and mentioned in PR description. This change aimed to have working application by limiting zoom functions in some use-cases. Zoom-to-mouse started working if you rotate parts plane by some amount. Current implementation of zoom-to-mouse implemented like this:
Problem happens when the screen plane is parallel to Z-axis. In this case current code can't find position of either screen center nor mouse cursor as viewing vector never intersects parts (XY) plane returning vectors which has infinity coordinates. And because of this infinite camera translations makes it impossible to get parts plate back into screen. Another use-case is really small angle of XY plane view which results in really big translation vectors like (10^6,10^20) - this too could move view port far away. Proposed solution checks if translation vector has reasonable values and falls back to zoom-to-center logic if it's not. Once you get parts plate to an angled position, zoom-to-mouse starts working as usual. One more point of request for testing is to get public feedback. There should be way completely re-implement zoom-to-mouse logic to get rid of this fundamental flaw, but it may require some time for me to get into details of 3D rendering and camera handling on current code base. |
5b87eb7
to
f28c851
Compare
@discip , could you check updated version. I've found an easy way to fix the issue keeping zoom-to-mouse for all cases including Ctrl+<3..6> |
Thank you!That definitely did the trick! 👍 But there is still some annoyance regarding the the
I hope I made myself clear enough. 😅 btw:
thank you very much in advance |
Thank you very much!
That would be really great!
Will do as soon as I get home again! |
That one should be fixed in f941a92
I'd like to move it into own issue since it is more about general input events handling in the app globally rather than camera position. For example: if you click to any test field on the left pane and modify value there by entering value and pressing either Return or Tab, you'll end up with the same issue: keyboard events not reaching 3D view. |
Thank you, will test later. 😃👍
Do as you wish, Sir. |
I tried to click in the area where the tick should have been, and sure enough there was one, except not visible because the text and box seem to be white.
That worked absolutely flawlessly! 👍While you're at it, there's one more thing that could be adjusted, unless it's intentional: |
regarding your issue with popup on application start: I can't reproduce it on my end, so I've tried to do my best trying to solve it blindly. Could you please check if https://github.com/buzzhuzz/OrcaSlicer/actions/runs/8540040433 gets "Remember my choice" checkbox visible for you? Also, you may create an issue for this bug so every affected user may track the progress and test fixes on their side. Regarding the 3D cube gizmo. I've found a way to fix it. However, the more I dig into this, the more use cases I see (including user input using 3d mouse devices) which might be affected by a simple fact that the world gets translated on zooming to a mouse cursor. I'd like to take a break and weight two approaches: going down a rabbit hole fixing all possible scenarios risking break something and re-implementation of core zoom-to-mouse logic. |
Converted PR to a draft. The reason is in previous comment. |
That is definitely a good idea.
As the testing phase might take some time I suggest to split this PR into the part that is already working, which could get implemented already and the part that still needs to be polished. |
Plater disappeared when zoom-to-mouse enabled and user tries to zoom with a side view enabled (Ctrl+<3..6>). Mouse/screen center position estimation in 3D is made by calculating intersection of a mouse vector which comes 'through' the screen with an XY plane. However, when screen is parallel to Z axis, intersection point located at infinite which results in infinite camera translation vector. This change switches mouse position estimation to use of projection matrix like its done for camera panning.
f941a92
to
489be8c
Compare
I have reverted latest change which made Ctrl-<1..6> focus on a build plate. Reason for this is to make behavior consistent for all use-cases including camera panning (RMB+move) which moves target point in 3d space. Target point is a point camera focused to. My thoughts are next:
As for 3D view gizmo and camera angles: they are setting camera view in regard to a current focus point. Because of this, I consider correct rotating around some point in space which is not on a build plate. I totally get that using rotate gizmo and camera angle shortcuts may be inconvenient in some cases, but same happens for simple camera panning. I could suggest adding some shortcut to switch focus point into a build plate (or even selected objects) which could make life a little easier, like this: focus-key-demo.mp4 |
There was a problem hiding this 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 very much!
Plater disappeared when zoom-to-mouse enabled and user tries to zoom
with a side view enabled (Ctrl+<3..6>).
Mouse/screen center position estimation in 3D is made by calculating
intersection of a mouse vector which comes 'through' the screen with an
XY plane. However, when screen is parallel to Z axis, intersection point
located at infinite which results in infinite camera translation vector.
This change switches mouse position estimation to use of projection
matrix like its done for camera panning.
Fixes #4797, #4579, #3615