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

ImSequencer - Zooming with mouse wheel at cursor position #122

Open
nyaki-HUN opened this issue Aug 28, 2020 · 2 comments · May be fixed by #124
Open

ImSequencer - Zooming with mouse wheel at cursor position #122

nyaki-HUN opened this issue Aug 28, 2020 · 2 comments · May be fixed by #124

Comments

@nyaki-HUN
Copy link

nyaki-HUN commented Aug 28, 2020

I know this feature is currently defined out in the code, but here is a working version I am using which can perform zooming in/out at the cursor position properly with the mouse wheel.

                    int frameOverCursor = (int)((io.MousePos.x - topRect.Min.x) / framePixelWidth) + firstFrameUsed;
                    if (io.MouseWheel < -FLT_EPSILON)
                    {
                        framePixelWidthTarget *= 0.9f;
                        framePixelWidth *= 0.9f;
                        int newFrameOverCursor = (int)((io.MousePos.x - topRect.Min.x) / framePixelWidth) + firstFrameUsed;
                        *firstFrame += frameOverCursor - newFrameOverCursor;
                    }

                    if (io.MouseWheel > FLT_EPSILON)
                    {
                        framePixelWidthTarget *= 1.1f;
                        framePixelWidth *= 1.1f;
                        int newFrameOverCursor = (int)((io.MousePos.x - topRect.Min.x) / framePixelWidth) + firstFrameUsed;
                        *firstFrame += frameOverCursor - newFrameOverCursor;
                    }
@CedricGuillemet
Copy link
Owner

Sounds like a good fix. Could you please do a PR for that?

@nyaki-HUN nyaki-HUN linked a pull request Aug 31, 2020 that will close this issue
@nyaki-HUN
Copy link
Author

There you go.

Also I kept the #if 0 block around the code in the PR just to make sure I won't break anything for someone, because zooming can collide with using the scrollbar.
Maybe a new option flag will be required later to set correct behavior and disable the scrollbar.

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 a pull request may close this issue.

2 participants