Problem grabbing a resize handle

I have some custom nodes and they show resize handles when selected. The center of each handle is aligned with a node corner, it means that 75% of the handle is outside the node. When I try to resize the node and grab the part of the handle which overlays the node, everything works as expected, but when I grab any other part of the handle (lying outside the node) the whole diagram moves. This happens because I’m using my custom GoToolPanning which detects if the left mouse button was pressed on the background and then moves the whole diagram together with the mouse cursor (Google Maps style panning).
This is the detection method:

public override bool CanStart()
{
if (LastInput.Buttons == MouseButtons.Left)
{
GoObject obj = View.Document.PickObject(LastInput.DocPoint, true);
return obj == null;
}
return false;
}

How can I recognize that the cursor is currently above a resize handle? PickObject returns only “real” object, but not handles.

You’re calling the GoDocument.PickObject method. What you want to call is the GoView.PickObject method:

GoObject obj = this.View.PickObject(true, true, this.LastInput.DocPoint, true);
This will pick either a document object or a view object, whichever is in front at the point. View objects include selection handles and the grid and any sheet.
Since the GoView.Grid and GoView.Sheet (if it exists) are normally part of the GoView.BackgroundLayer, you'll need to make sure that they cannot be selected by your call to GoView.PickObject. To do that, you'll also need to initialize your view as follows:
goView1.BackgroundLayer.AllowSelect = false;

Thanks Walter, now it works Smile