Improving hit test behavior

I am having trouble accurately picking links that are really close together.I have a network with many criss-crossing links, and when I zoom in close to a particularly nested area, I’m unable to reliably pick on links. Has anyone seen this problem before? If so, any ideas on how to improve the accuracy of the picking?
TIA - Mark

It turns out that picking precision is (currently) independent of the GoView, so it isn’t able to be more precise when you are zoomed in.
GoStroke.PickMargin is the property that controls how far off the a pick can be to still get that stroke.
You might be able to implement a hack by overriding PickMargin to return a static variable that you set according to the scale of the current view. (Maybe 3/GoView.DocScale – I haven’t experimented with this.)

I’m actually using a LabeledLink object, which might be confounding the problem. When I pick on a link’s associated label, it picks the link, even if I’ve set MidLabel.Selectable=false. When I hide the labels, it appears to work better. Do I have to do something else in order to force the pick to ignore the labels?

I haven’t tried this either, but maybe overriding Pick on your GoLabeledLink class will let you pretend the labels don’t exist when selecting:
public override GoObject Pick(PointF p, bool selectableOnly) {
if (selectableOnly)
return this.RealLink.Pick(p, true);
else
return base.Pick(p, false);
}

That did the trick. Actually, I needed to fully override the Pick method because I don’t want the label to be “Picked” during a mouse-over event.
public override GoObject Pick(PointF p, bool selectableOnly)
{
// Delegate all picks to the real link. Don’t want to be able to pick on label
return this.RealLink.Pick(p, selectableOnly);
}

Thanks again

The PickMargin does not seem to be helping the accuracy of the picking, so I was wondering if there was some other way to go about this. Can I get a list of the strokes that are within a certain distance from the current point, and pick the closest one somehow?

You could use GoDocument.PickObjectsInRectangle and GoStroke.NearestPointOnLine.