The clickable region of a link


#1

We set the width of our link to be “0”, to avoid the link getting thicker when we zoom in, but the clickable region for selecting the link is still very thick when we zoom in to a large scale. We have links layout very close each other, when we zoom in to a large scale, the clickable region of links are overlapped each other, we can not pick the link we really want to pick.

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

How do we set the clickable region of a link thinner, may be a few pixels width?

Wendy


#2

You can override GoStroke.PickMargin to return a value other than the default, which is 3.


#3

Thanks, Walter.
I have tried override GoStroke.PickMargin() as this:
public override float PickMargin
{
get
{
return 1.0F;
//Debug.WriteLine("base.PickMargin: " + base.PickMargin );
//return base.PickMargin;
}
}
From return base.PickMargin (it was 3) to return 1.0F, there was improvement, pick margin indeed got narrower. But I also tried return 0.0001F and even return 0, they had no difference than return 1.0F, when I zoom in to large scale, there was still a wide pick margin. Any other suggestions?
Wendy


#4

Hmmm. Our code assumes a minimum line width of 1, which explains the behavior you see.
For now, you can try returning a value of -1.0F, although in the future we ought to treat this property as having a minimum of zero. This isn’t perfect; a real solution will require our future consideration.


#5

Can I understand better how this return -1.0F works? My experiment is that, for a line with an angle, it has a narrower pick margin (compare with return 1.0F), but for a straight line, horizontal, or verticle, it has no pick margin at all, in an other word, I can not pick any straight lines.
Wendy


#6

Hmmm, I suppose that makes sense. You’ll need to have it returning 0 then. We’re going to have to investigate this in the future.
Zero-width pens cause a lot of subtle problems.


#7

Since we can not resolve this issue until GO has a real solution to handle “0” pick margin.
We are going to do something in our code, here is the thought, we need your input before we implement it.
When we get a event OnSingleClick( or OnGotSelecton) in our GisLink (derived from GoLink), we will check the click point is exactly in our link, or may be give a very narrow margin, if it is true, we consider this link is selected, otherwise, we will need drop this link, let next link which is overlapped by the first link to take over the OnSingleClick(or OnGotSection) event, and do the same checking, if is true, mark this second link is selected, otherwise, go to the third overlapped link, so on and so on. Our questions will be
1. Could this idea work?
2. Are all overlapped objects got OnSingleClick or OnGotSection events when we click a point on those objects?
3. Any other things we need to consider?
Wendy


#8

That might work–you’d have to use PickObjects, which returns an IGoCollection of objects at a point, instead of PickObject, which just returns the first/front-most one it finds.
You might want to extend your application’s picking user interface to explicitly allow them to select from that collection of objects. This also helps in the case where there really are two or more objects at exactly the same point, and the user doesn’t want to get the one that happens to be the most in front.


#9

We will give a try
Wendy