Android Question TouchImageView

dannyjon

Member
Licensed User
How can I plot a mark over a touchimageview which also moves when the view is dragged. Is there a way to consume to drop co-ordinates after drag?
 

agraham

Expert
Licensed User
I don't know about TouchImageView as I use my ScaleImageView which is Android only but is meant for this sort of application. It can natively draw a circle at a point of an image that moves with the image and can scale with the image if needed. It also gives you an OnDraw event so that you can draw anything you want on the image.

ScaleImageView - Pan and zoom large images | B4X Programming Forum
 
Upvote 0

dannyjon

Member
Licensed User
Upvote 0

dannyjon

Member
Licensed User
I have a question about this library: How can I stop the circle being added in the centre of the image on startup? Can not see where this is added. Is there an option to remove a circle drawn or should the canvas be initialized again?
 
Last edited:
Upvote 0

dannyjon

Member
Licensed User
Which library? If you mean ScaleImageView the circle and text are drawn in the Viewer.ScaleImageView1_OnDraw event. Read all the comments in the XML and all should be clear.

Yes I have read the XML and understand how the Viewer.ScaleImageView1_OnDraw event works but there is no code in the example that shows how the circle in the image below is created unless it is in another method but I have checked and don't see where it could be coming from. I have returned out of the ...OnDraw but still this circle appears on the first run. Sorry for my confusion! Screenshot_20210526-075427.png
 
Upvote 0

agraham

Expert
Licensed User
From the XML and shown as Intellisense in the IDE
EnableCircle

Property
Readable As Boolean
Writeable As Boolean

Gets or sets whether a circle will be drawn at the image coordinates specified by CircleX and CircleY. The default is False.
This is also a Designer property "Enable Circle". In the Viewer layout it is set True.
 
Upvote 0

dannyjon

Member
Licensed User
From the XML and shown as Intellisense in the IDE
This is also a Designer property "Enable Circle". In the Viewer layout it is set True.

I set the property to False in the designer and when clicking the siv there are no circles. Setting True/False in code also produces the same result so either you have to have the centre circle with circles appearing on touch or no circles at all.

Solution was to set circleX,CircleY = -10 and then the only circles that appear are when the SIV is touched.
 
Last edited:
Upvote 0

agraham

Expert
Licensed User
so either you have to have the centre circle with circles appearing on touch or no circles at all.
No you don't. Examine the OnDraw event code. The clicked circle presently uses the radius of the intrinsic circle, if the intrinsic circle is not drawn the radius is zero so the clicked circle won't be drawn. Set the radius separately. You can draw whatever shapes and text you want wherever you want in the OnDraw event. There are no limitations.
 
Upvote 0
Top