MikeOrtiz / TouchImageView

Adds touch functionality to Android ImageView.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cant free move image

miladesign opened this issue · comments

Hi. thanks for this library. if i zoom out image then image is always in center. cant move it to corners for example. can you fix this?
if i change this:

MotionEvent.ACTION_MOVE -> if (state == State.DRAG) {
 val deltaX = curr.x - last.x
 val deltaY = curr.y - last.y
 val fixTransX = getFixDragTrans(deltaX, viewWidth.toFloat(), imageWidth)
 val fixTransY = getFixDragTrans(deltaY, viewHeight.toFloat(), imageHeight)
 touchMatrix!!.postTranslate(fixTransX, fixTransY)
 fixTrans()
 last[curr.x] = curr.y
}

to this:

MotionEvent.ACTION_MOVE -> if (state == State.DRAG) {
 val deltaX = curr.x - last.x
 val deltaY = curr.y - last.y
 touchMatrix!!.postTranslate(deltaX, deltaY )
 last[curr.x] = curr.y
}

its work but when i save image nothing change.

You want to have it, maybe others don't. That's why it needs an attribute to choose.

Independent of this, if there is a pull request, I'll approve it immediate

thanks. i used this code and its work good now:

MotionEvent.ACTION_MOVE -> if (state == State.DRAG) {
 val deltaX = curr.x - last.x
 val deltaY = curr.y - last.y
 touchMatrix!!.postTranslate(deltaX, deltaY )
 fixTrans()
 last[curr.x] = curr.y
}

I made a pull request out of your suggestion #304

To be honest, I don't get the point, what's now better with your suggestion. This is the master branch

corner-zoom.mp4

Please can you demonstrate your improvement ?

Btw, I made a sceen record in Emulator and converted *.webm to *.mp4 by https://cloudconvert.com/webm-to-mp4

Hi. i used this library inside PhotoEditor library. so before i made any changes i resize image but it was always in center. after i made that change now i can resize image and move it then save it using PhotoEditor library.

commented

This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you!

image

How can i free move my image? Is it possible using the TouchImageView? Like you can see I have an overlay and i would like to crop by the overlay.

I have configure the TouchImageView
scaleType = ImageView.ScaleType.CENTER_CROP
maxZoom = 5f
minZoom = 1f

commented

Closing this. Please reopen if you believe it should be addressed. Thank you for your contribution.