I am using chrisbanes/PhotoView library to handle image zoom/pan.
I am displaying an overlay on top. Basically, I add a view on top of the image view at specific coordinates.
For example, I add a custom view (where I draw an arrow in the onDraw method) at location (200,300) when photoView originally load the image.
Now let's say the user zoomed/panned. How can I adjust the custom view location so it is located on the same spot (in relation to the image) as before.
I have spent few days pulling hair and can't figure it out. I don't want the overlay to zoom. I just want it's location to be correct
Thank you
Here is my XML so you have an idea of things
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rootView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.github.chrisbanes.photoview.PhotoView
android:id="@+id/ivMainPhoto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<com.xx.xx.GraphicOverlay
android:id="@+id/graphicOverlay"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="@+id/ivMainPhoto"
app:layout_constraintEnd_toEndOf="@+id/ivMainPhoto"
app:layout_constraintStart_toStartOf="@+id/ivMainPhoto"
app:layout_constraintTop_toTopOf="@+id/ivMainPhoto" />
</android.support.constraint.ConstraintLayout
Basically here the overlay is just container where I add my custom views. So basically 0,0 starts at the top left corner of the PhotoView
you can use
OnViewTapListener
to get touch co-ordinate on zoomed image Like,