MichaelRumpler / GestureSample

Sample App for MR.Gestures
MIT License
58 stars 17 forks source link

Cant get image Pinch Zoom working - Modal ContentPage #51

Closed GenCodeInc closed 4 months ago

GenCodeInc commented 4 months ago

Hello Michael,

I made a small prj trying to do a simple pinchzoom and pan, I took your example and added it to my solution I made it public here https://github.com/GenCodeInc/ImageZoom

I see all the output, but the image does not move or zoom on pinch

Screenshot 2024-06-04 at 11 02 29 PM jpeg

  Navigation.PushModalAsync(new ImageXaml());

{ public ImageXaml() { BindingContext = new ViewModels.TransformImageViewModel(); InitializeComponent(); }

MichaelRumpler commented 4 months ago

MR.Gestures tells you what gestures happened, but you need to use that information yourself. With the EventArgs the TransformViewModel is changed, but you don't bind those values to your image properties in the view. You also copied the ImageXaml - the only sample which does not do that. Look at the ContentPage sample. That one also manipulates the image in the view.

GenCodeInc commented 4 months ago

Thanks so much I was able to get the pan to work well, but pinch zoom is a little wonky. I haven't been able to get the contentvew sample to work in my prj or move at all I think I'm missing something for that, but not sure.

GenCodeInc commented 4 months ago

Yay.... I got it ContentPageXaml version of image zoom working now, I think my new Image code was messing it up so I separated my image only zoom transformation VM to one called 'TransformImageViewModelImageTest' where I can test independently. Seems a lot harder to get the Image to work directly than the ContentPage. I checked in my code for direct image, it does pinchzoom directly on the image but it's kinda goofy when it does (lots of flashing). Thanks again for the feedback, for now il use the ContentPage method as its so much smoother.