Skip to content

Commit

Permalink
Merge pull request #329 from SimFG/SetZoomOpt
Browse files Browse the repository at this point in the history
SetZoom update the method to calculate the trans
  • Loading branch information
hannesa2 authored Mar 5, 2021
2 parents c50c942 + bc7b506 commit 7cacf2d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions touchview/src/main/java/com/ortiz/touchview/TouchImageView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,8 @@ open class TouchImageView @JvmOverloads constructor(context: Context, attrs: Att
resetZoom()
scaleImage(scale.toDouble(), viewWidth / 2.toFloat(), viewHeight / 2.toFloat(), true)
touchMatrix!!.getValues(floatMatrix)
floatMatrix!![Matrix.MTRANS_X] = -(focusX * imageWidth - viewWidth * 0.5f)
floatMatrix!![Matrix.MTRANS_Y] = -(focusY * imageHeight - viewHeight * 0.5f)
floatMatrix!![Matrix.MTRANS_X] = (viewWidth - matchViewWidth) / 2 - focusX * (scale - 1) * matchViewWidth
floatMatrix!![Matrix.MTRANS_Y] = (viewHeight - matchViewHeight) / 2 - focusY * (scale - 1) * matchViewHeight
touchMatrix!!.setValues(floatMatrix)
fixTrans()
savePreviousImageValues()
Expand Down

0 comments on commit 7cacf2d

Please sign in to comment.