Skip to content

Commit

Permalink
Merge pull request #514 from MikeOrtiz/zoom
Browse files Browse the repository at this point in the history
Revert "SetZoom update the method to calculate the trans"
  • Loading branch information
hannesa2 authored Jan 23, 2023
2 parents 2796c2d + 5bbcb08 commit 5b6f2cf
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class MainSmokeTest {
fun testChangeSize() {
Espresso.onView(withId(R.id.resize_button)).perform(ViewActions.click())
Intents.intended(hasComponent(ChangeSizeExampleActivity::class.java.name))
Thread.sleep(500)
Espresso.onView(isRoot())
.captureToBitmap()
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}")
Expand Down
2 changes: 1 addition & 1 deletion app/src/androidTest/java/info/touchimage/demo/TouchTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TouchTest {
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-touch1")
onView(withId(R.id.imageSingle)).perform(TouchAction(40f, 80f))
Thread.sleep(300)
takeScreenshot()
onView(withId(R.id.imageSingle)).captureToBitmap()
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-touch2")
}

Expand Down
Binary file modified screenshotsToCompare/MainSmokeTest_testAnimateZoom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshotsToCompare/TouchTest_testSingleTouch-touch2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshotsToCompare/ZoomTest_zoom-1-init.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshotsToCompare/ZoomTest_zoom-3-zoom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ -394,8 +394,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] = (viewWidth - matchViewWidth) / 2 - focusX * (scale - 1) * matchViewWidth
floatMatrix[Matrix.MTRANS_Y] = (viewHeight - matchViewHeight) / 2 - focusY * (scale - 1) * matchViewHeight
floatMatrix[Matrix.MTRANS_X] = -(focusX * imageWidth - viewWidth * 0.5f)
floatMatrix[Matrix.MTRANS_Y] = -(focusY * imageHeight - viewHeight * 0.5f)
touchMatrix.setValues(floatMatrix)
fixTrans()
savePreviousImageValues()
Expand Down

0 comments on commit 5b6f2cf

Please sign in to comment.