MikeOrtiz / TouchImageView

Adds touch functionality to Android ImageView.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect zoom coordinates when calling setZoom()/setZoomAnimated()

bartek-wesolowski opened this issue · comments

I used an older version of TouchImageView in my map app. I have hardcoded point coordinates. I call setZoomAnimated() when someone searches for a particular point. When I updated to the newest version of TouchImageView then setZoomAnimated()/setZoom() started zooming on a different place even though the focus coordinates didn't change. On version 3.0.3 everything still works correctly. On 3.0.4 the focus coordinates are different.

Steps to reproduce
Use TouchImageView version 3.0.3 to show an image. Pan the image using setZoom(2f, 0.7f, 0.7f). Take a screenshot.
Do the same for version 3.0.4. The screenshots will be different even though the focus coordinates are the same.

It looks like that it's related to #329

To be honest, it's a community project and I'm happy to merge any pull request

This change might have caused the problem.

This change and #329 are the same 😁

But how to proceed ? I've no clue. @SimFG do you have an idea ?

You can use an image like the one below to test it. When I call setZoom(3f, 0.75f, 0.75f) I'd expect the focus to be on C7, and right now it's not there. Before the change it was working fine.

test_grid

PR #509 doesn't fix the issue, but it helps hopefully later to find a solution with a test for zoom behavior.
At the bottom of the job you'll find Touch-Screenshots and here you'll find

image

This is the current situation. And at least it's a baseground

image

I think that the changes made in #329 should be reverted because the formula is incorrect. Isn't the situation described in #329 (comment) a feature and not a bug? If we focus on point 0,0, don't we expect the image to be moved down like that? If not, shouldn't we adjust getFixTrans() instead of setZoom()? I started working on it a bit, but I'm going on vacation tomorrow and won't have access to my computer for a week.

BTW, using Paparazzi for screenshot tests would be nice.

I started working on it a bit, but I'm going on vacation tomorrow and won't have access to my computer for a week.

I would love to see some outcome in the future !

closed with #514