shaigem / BlazorPanzoom

Blazor wrapper for timmywil's panzoom library that helps make zooming and panning of Blazor components and elements easier
https://shaigem.github.io/BlazorPanzoom/
MIT License
44 stars 12 forks source link

Zoom while contained inside #29

Closed SABogdan closed 1 month ago

SABogdan commented 1 month ago

Heya,

Trying a few things out - but looks like there is an error somewhere

<Panzoom @ref="_panzoom" WheelMode="@WheelMode.Custom" OnWheel="@OnWheel" PanzoomOptions="@(new PanzoomOptions {Canvas = true, Contain = Contain.Inside})"> <img src="@selectedImageUrl" class="img-fluid" alt="Selected Job Image" @ref=@context.ElementReference> </Panzoom>

I wanted to zoom in - while containing the image inside the div.

Throws this error - Exception thrown: 'Microsoft.JSInterop.JSException' in System.Private.CoreLib.dll

Kind of a bit logic, because when you zoom in - you go out of bounds - but is there a way to keep the image inside of a div?

I'm using a modal to pop up the images and i want to keep the image inside the modal

SABogdan commented 1 month ago

PanzoomOptions="@(new PanzoomOptions {Canvas = true, DisableXAxis = true, DisableYAxis = true})"

Dose the trick