Annotation Bugs

Discussions about annotation support.
Post Reply
mattewan
Posts: 33
Joined: Fri Apr 03, 2009 5:58 pm

Annotation Bugs

Post by mattewan » Fri Apr 28, 2017 10:34 am

Hello,

I have noticed a few bugs with the annotations implementation.

I am drawing an a rect box on a gdpicture viewer, then using code to place an annotion (rectangle) in that place, as well as lots of other annotations which make it look like that box is a container for all the other annotations.

I am handling the gdviewer.annotationMoved event, so that when I move that container annotation, i get the new position and move all the other annotations to the same location, making it look like the container annotation actually contains them.

When I use the following code in AnnotationMoved:

_lControls(id).labelObject.Left = _gdViewer.GetAnnotationFromIdx(AnnotationIdx).Left
_lControls(id).labelObject.Top = _gdViewer.GetAnnotationFromIdx(AnnotationIdx).Top - 0.2

_gdViewer.GetAnnotationFromIdx(AnnotationIdx).Top returns the center point on the moved annotation, not the top point. For example, if I move a 1 inch in height annotation to the top left cornet for the document, left will return 0 (or close to it) but top will return 0.5, not 0.

Also, AnnotationMoved doesn't fire everytime. If i continually move the annotation around, in 1 in every 5 or so the annotation moved event doesn't get raised.

I'm using the latest version of gdpicture12

Cheers,

Matt

mattewan
Posts: 33
Joined: Fri Apr 03, 2009 5:58 pm

Re: Annotation Bugs

Post by mattewan » Fri Apr 28, 2017 11:32 am

Just a follow up.

Actually both the left & top properties return the mid position. Here is a perfect way to reproduce:

Dim containerObject As GdPicture12.Annotations.AnnotationRectangleHighlighter
Dim left, top, width, height As Single
left = 1
top = 1
width = 1
height = 1
containerObject = gdTemplate.GetAnnotationManager.AddRectangleHighlighterAnnot(Color.LightBlue, left, top, width, height)

Debug.Print("Left: " & containerObject.Left)
Debug.Print("Top: " & containerObject.Top)
Debug.Print("Width: " & containerObject.Width)
Debug.Print("Height: " & containerObject.Height)

That will print the following output:

Left: 1.5
Top: 1.5
Width: 1
Height: 1

should all be 1

As for the AnnotationMoved event not firing everytime.... that was in a bug in my code, so ignore that.

Gabriela
Posts: 436
Joined: Wed Nov 22, 2017 9:52 am

Re: Annotation Bugs

Post by Gabriela » Sun Feb 03, 2019 6:41 pm

Hello,

The annotation's coordinates Top and Left always represent the MIDDLE point of the bounding box of the annotation as it is documented here:
https://www.gdpicture.com/guides/gdpicture/web ... ~Left.html
https://www.gdpicture.com/guides/gdpicture/web ... n~Top.html

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest