Bounding Box shifting when zoom is done on shapes

Hi Jake,
I am facing a issue.The details are:
In my application i have a functionality of highlighting shapes when mouse hover is done.I achieve this using ObjectEnterLeave event.I also have a functionality in which i can zoom in and zoom out the view, so I am controlling this using Docscale property. The issue is that at certain zoom levels, mostly at Docscale value more than 5, my shape’s bounding box tends to shift towards one side such that when mouse is hovered towards that side highlighting is achieved from a fairly far point and from the other end, it starts from the center or near center of the line. So with zoom levels changing, the bounding box is not getting aligned with the shape.

Behaviour required: I want to achieve highlighting from fairly same distance from both sides.
I am attaching code snippet and snap shots.
Code Snippet:
void goView1_ObjectEnterLeave(object sender, GoObjectEnterLeaveEventArgs e)
{
GoObject pFrom = e.From;
GoObject pTo = e.To;
if (pTo != null)
{
((GoShape)pTo).PenColor = Color.Red;
}
if (pFrom !=null)
{
((GoShape)pFrom).PenColor = Color.Black;
}
}
private void button1_Click(object sender, EventArgs e)
{
Pen pPen = new Pen(Color.Black);
pPen.Width = 1.12092364f;
GoDrawing pDraw = new GoDrawing();
pDraw.Pen = pPen;
pDraw.StartAt(10, 10);
pDraw.LineTo(50, 10);
pDraw.LineTo(50, 50);
goView1.Document.Add(pDraw);
goView1.DocScale = 0.6f;
}
private void button2_Click(object sender, EventArgs e)
{
goView1.DocScale += 0.5f;
}
P.S.:I am unable to insert pictures, due to insufficient rights. I was earlier able to do that.Please give me permission so that I can attach pictures.
Thanks,
Vinayak

We haven’t changed anything that should affect inserting pictures, but we’ll look into that.



Regarding your issue, I can’t reproduce the issue in either FlowCharter (which highlights ports) or IconicApp (which displays info about where the mouse is). And I zoomed into max.

Hi Jake, <?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

If you could follow these steps, I think you will be able to reproduce the issue:

1. On a GOView, make a GoDrawing object, like this:

GoDrawing pDraw = new GoDrawing();
Pen pPen = new Pen(Color.Black);
pPen.Width = 1.12092364f;
pDraw.Pen = pPen;
pDraw.StartAt(10, 10);
pDraw.LineTo(50, 10);
pDraw.LineTo(50, 50);
goView1.Document.Add(pDraw);
goView1.DocScale = 0.6f;
2. Make another button which has this code in click event:
goView1.DocScale += 0.5f;
3. Attach an object enter leave event, with following code:
void goView1_ObjectEnterLeave(object sender, GoObjectEnterLeaveEventArgs e)
{
GoObject pFrom = e.From;
GoObject pTo = e.To;
if (pTo != null)
{
((GoShape)pTo).PenColor = Color.Red;
}
if (pFrom !=null)
{
((GoShape)pFrom).PenColor = Color.Black;
}
}

I think you are unable to produce it because you are using complex shapes, please try simple shapes like a L shaped line, which is built using GoDrawing.Using Zoom Button you can zoom your shape.

Image1 Description: Highlighting started from Right side

Image2 Description: Highlighting started from Left side

Image3 Description: Highlighting not started from Right side

Here the actual color of the line is black and on Mouse hover I am coloring it to Red.As you can see in image 2 that highlighting can done from fairly large distance and in image 3: line should have been highlighted but it is not.

Selection in GoDiagram is oriented towards making diagrams usable. There is some “extra” added in for links (and strokes in GoDrawing) for making single pixel wide things (like links between nodes) pickable without the user having to click multiple times to get the exact positioning.



That extra is “GoDrawing.PickMargin” and it defaults to 3. You can try setting that to zero to see if that helps. I suspect it will help, but isn’t going to make things perfect. The selection code in GoDiagram just isn’t oriented to zooming in 1000% and still being pixel perfect.



Is zooming in like this something you’d really expect a real user to do?

This may also be related to PenAlignment. See this note.