Closed PhilippPaetzold closed 1 year ago
Take a look at my fork for it: https://github.com/HoneyTauOverTwo/PanAndZoom/tree/ZoomIntoArea
I also needed this functionality. Peer-reviewing is greatly appreciated.
[edit] Note that I did not implement box selection in the GUI, what I implemented is only a method that receives a rectangle to zoom into.
If you can implement the box selection logic to save the top left corner when the mouse is clicked and bottom right corner when the mouse is released, you should be able to create a Rect from those and then use the ZoomIntoArea method.
Thanks @HoneyTauOverTwo, I will review your implementation and try to include it in my app for further testing.
@HoneyTauOverTwo Sorry it took me ages, but I created a small VS2022 .NET demo project
2023-03-29_13-03-19_ImageViewer.zip to evaluate your fork of ZoomBorder, especially the ZoomIntoArea
method. In the demo, you can open an image and perform a rectangle zoom by holding the left mouse button. When you release the button again, I invoke the ZoomIntoArea
method, so it should zoom and pan automatically and according to the zoom rectangle. Unfortunatly its not really working as expected. It would be great, if you could check it out.
I like to use this library for implementing an image viewer. So far it works great for panning and zooming with the mouse wheel. What I am missing is a rectangular zoom. Could you give me any clues how to best implement this? Thank you for your great work. This is really the best library for panning and scrolling with avalonia.
Best regards Philipp