Skip to content

CodingOctocat/MauiPanPinchContainer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

MauiPanPinchContainer

Why MauiPanPinchContainer?

I recently developed a MAUI app and needed a control that would allow the user to view an Image, like an Android/iOS photo album, I tried Bertuzzi.MAUI.PinchZoomImage, but it had some UX issues, then I tried reading the documentation .NET MAUI Docs/Recognize a pangesture , .NET MAUI Docs/Recognize a pinch gesture, After a few days of lots of attempts, I finally implemented the MauiPanPinchContainer!

Honestly, the code is all mathematical calculations, and I don't fully understand it, so if I could, I'd like to see in the code Contnet.Anchor to stay at the default value of 0.5 (I'm not sure if 0.5 is better), but I'm limited in my ability/time to do that for now.

Usage

There are no plans to release a NuGet version for the time being, as PanPinchContainer is still very simple in its functionality, with hard-coded parameters, lack of flexibility, and no customizable dependency properties

<PanPinchContainer>
    <Image Source="hello_maui.jpg" />
<PanPinchContainer>     

Features

  • 1x ~ 10x Scaling: Supports scaling from 1x to 10x.
  • 0.5x Temporarily Scaling: Supports pinch and temporarily scale down the image below 1x. Upon release, the image restores to 1x.

Supported

  • Boundary Constraints: Limits scaling and panning within image boundaries.
  • Double Tap to Zoom: Double tap to zoom in (2x) or zoom out (1x).
  • Scaling Based on Pinch Position: Scale based on the position of the pinch gesture.
  • Panning and Zooming Animation: Smooth panning and zooming animations.

Not Supported

  • Rotation
  • Inertial panning
  • Slightly more than 10x temporarily scaling

Demo

MauiPanPinchContainer_Demo.mp4

Releases

No releases published

Packages

No packages published

Languages