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

Inception panzoom stops working after zoom #26

Closed Drsorab closed 5 months ago

Drsorab commented 5 months ago

Hello,

i have a weird problem. I have installed everything ok they are working fine. I try the inception pan zoom and i use the code in the tiger example (but i have another jpeg image instead of the tiger). At first i can pan the image and the image with the message just fine but when i zoom in or our i cant pan the image with the message any more. The rest are working as intended.

The following piece of code seems to update the values just fine but i dont see the result on screen

    await _panzoom2.SetStyleAsync(
        "transform",
        $"scale({eventArgs.Scale}) translate({eventArgs.X / parentScale}px, {eventArgs.Y / parentScale}px)");

any ideas what might be the problem?

Drsorab commented 5 months ago

sorry for posting here in the first place but i found out what was wrong. This calculation eventArgs.X / parentScale at first is integer but when you zoom it becomes double. And the "SetStyle" js function doesnt like a double with a comma separator. Switch the comma to a dot and you are good to go. Example : 1,25 -->1.25