-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add image::Viewer
widget
#319
Conversation
This looks great! Thank you. I think we could put this new widget inside the current
I will try to get this ready soon!
I implemented some logic to do this in the new
I'd probably put these in |
Thanks for taking a look! I'll definitely move this into the |
I went ahead and renamed it I'm going to hold off on implementing logic for zooming to the cursor until we can center the image inside the Clipping primitive, as to not have to rewrite anything. I'll implement the builder methods then as well. |
Yeah, I tend to only re-export the types that have the same name as the module.
Since #325, there is a new |
Ok, I renamed to
Awesome! Looking forward to this change |
The new primitive already landed in |
Nice, I wrapped the |
Ok, everything should be implemented! After performing mental gymnastics all morning, I finally got the calculations worked out to translate the image so it's centred with the proper adjustments made for smooth scaling in / out from cursor location. Note that currently image panning is bounded to the edges of the image, so you cannot infinitely pan past the image and therefore panning is only enabled when the image becomes clipped by it's width and/or height. |
Awesome! Thanks. I will review the changes soon. Merging #354 seems to have caused some conflicts. But don't worry about it, I should be able to fix them. |
The support for these layout constraints is currently not ideal. We should reintroduce these methods once our layout engine improves.
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 think I've brought this up to speed! 🎉
I have replaced the old Image
with this new widget in the pokedex
example. I tried to describe all the other changes in the commit history.
I think this should be ready to merge. Hopefully I didn't break anything. Let me know!
This is awesome! I'll test it out today and let you know :) |
@hecrj I've tested on my old project and it works great. Thanks for getting master back-merged into this properly! |
Awesome! We can finally merge this then! Thank you again 🥂 |
This isn't complete, but the zooming and panning features "work". If an image handle's dimensions are larger than the dimensions of the
ImagePane
, it is scaled down to fit inside the pane. Images smaller than the pane won't get rescaled until the mouse wheel is scrolled.Some improvements needed before merging:
ImagePane
. Can't implement this until negative offsets are allowed insideClip
primitiveState
to allow specifying the min / max scale factor and step sizeLet me know what you think and if there are any other features / defaults that should be added!
resolves #306