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

canvas zoom and scroll with mousewheel #1659

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

Conversation

Ant1r
Copy link
Contributor

@Ant1r Ant1r commented May 1, 2022

Zoom and scroll with the mouse wheel, like most modern software.

zoom

The code is adapted from https://wiki.tcl-lang.org/page/Canvas+zooming+using+mousewheel.
It will also allow to clean up the GUI C code from every IEMGUI_ZOOM() occurrences and logic ;-)

Note: the current zoom factor could be reported to the Pd-core side, in order to be saved to file.

@Ant1r
Copy link
Contributor Author

Ant1r commented May 2, 2022

Trying to update the line-width of lines and rectangles:

scrollzoom-linewidth-1

@umlaeute
Copy link
Contributor

umlaeute commented May 2, 2022

oh shit.

@Spacechild1
Copy link
Contributor

That's just awesome! Pd badly needs a proper zoom function...

@Ant1r
Copy link
Contributor Author

Ant1r commented May 13, 2022

"Almost" good here!
At least edition is now possible in a zoomed canvas.
Still some bugs, with "undo" for example.
Scrolling to the zooming center still to be done too.

@Ant1r
Copy link
Contributor Author

Ant1r commented May 14, 2022

I think it's about ready.
I've fixed some bugs, and added scrolling with mouse button 2 (scrollwheel button). Very pleasant...
Please test!

@Ant1r Ant1r marked this pull request as ready for review May 14, 2022 15:34
@Ant1r Ant1r changed the title [feature] POC control-mousewheel canvas zoom [feature] canvas zoom and scroll with mousewheel May 14, 2022
tcl/pd_canvaszoom.tcl Outdated Show resolved Hide resolved
tcl/pd_canvaszoom.tcl Outdated Show resolved Hide resolved
@umlaeute umlaeute added the feature suggestion for an enhancement label Sep 5, 2022
@Spacechild1 Spacechild1 changed the title [feature] canvas zoom and scroll with mousewheel canvas zoom and scroll with mousewheel Sep 14, 2022
@Ant1r
Copy link
Contributor Author

Ant1r commented Sep 27, 2022

internal zoom-state should (also) be kept as a "step" value

done. Now the depth is expressed in steps, and the actual depth is pow(2, steps / 100).
zsteps is kept within the [-400 , 400] range, so zdepth remains within [1/16 , 16].

@Ant1r
Copy link
Contributor Author

Ant1r commented Apr 9, 2023

This PR has been brought up to date.

I would appreciate it being tested in a variety of circumstances, so that we can insist to have it included.
My own tests show no obvious problem.

@Ant1r
Copy link
Contributor Author

Ant1r commented Jun 21, 2023

This PR has been updated to latest master, and debugged for MacOS and Windows.

@Ant1r Ant1r mentioned this pull request Jun 29, 2023
@Spacechild1
Copy link
Contributor

I already gave many thumbs up, but I haven't come around to actually test it yet. I will put this on my list and then lobby relentlessly to have this included in Pd 0.55 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature suggestion for an enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Offer more than two zoom settings
3 participants