Skip to content

Commit

Permalink
Fix x and y translation issue on double tap (#149)
Browse files Browse the repository at this point in the history
* Fix x and y translation issue on double tap

* Fix x translation issue which was caused by clamping
  • Loading branch information
bastionkid authored Jan 18, 2025
1 parent bce95cb commit 2f457db
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,8 @@ class PinchZoomRecyclerView : RecyclerView {
mScaleFactor = targetScale

// Adjust position so that it scales towards the double-tap location
mPosX -= (e.x - mPosX) * (1 - scaleDelta)
mPosY -= (e.y - mPosY) * (1 - scaleDelta)

clampPosition()
mPosX -= (e.x - mPosX) * (scaleDelta - 1)
mPosY -= (e.y - mPosY) * (scaleDelta - 1)
}

invalidate()
Expand Down

0 comments on commit 2f457db

Please sign in to comment.