2.5: LimitingSubGraph screen shot

Hello, I have a question on this new kind of subgraph.

I’d like something like what is presented (did not have the time to download this version yet, just read the description), but with a slightly different behaviour.

As long as the node would be only partially over the limit of the subgraph, snap it inside of the subgraph, just as described. But when the node becomes totally out of the subgraph, remove the node from the subgraph, and add it to the external container. A little bit like what happens un SugGraphApp when you Shift-Drag a node, but determined by how far the node is moved, not by a special key.

Do you think this behaviour would be easy to implement, starting from GoLimitingSubgraph ?

Best regards,

Well, it’s trivial to modify CanSnapPoint to return false when the point is well outside of some rectangle.
But that isn’t the behavior you want – the critical thing you mention is the need to change the parent of the node(s) being dragged. After all, once an object doesn’t belong to the subgraph, it’s hard for that subgraph to control it. So you really need to change the behavior of GoToolDragging, just like the SubGraphDraggingTool does in SubGraphApp.
I haven’t tried it, but I think that should be possible to change the implementation of SubGraphDraggingTool. Instead of calling GoToolDragging.MustBeMoving, which is true when the Shift key is down, you can look at the Bounds of the object(s) in the Selection relative to the original Bounds of the subgraph(s).
Where do you get the original Bounds of the subgraph(s)? You’ll need to remember those original subgraph Bounds in the override to DoDragging when the evttype is GoInputState.Start.

I’ll give it a try when I have the time to. Thanks !

(This note should be at Top… was lost and not returned)

Version 2.5 also demonstrates the use of the IGoDragSnapper interface, as implemented by a class that inherits from GoSubGraph.

The implementation of IGoDragSnapper.CanSnapPoint causes snapping to happen for this IGoDragSnapper only for immediate children of this subgraph. The SnapPoint method makes sure the Location of the object being dragged causes the object to stay inside the current border of the subgraph.

How then can the user adjust the size of the subgraph? The user can drag around a couple of rectangles (LimitingSubGraphMarkers) that are NOT constrained by LimitingSubGraph’s implementation of IGoDragSnapper.

LimitingSubGraphMarker also overrides GoObject.OnEnterLeave to set the Brush to Gold when the pointer is over the marker, to make it clearer to the user that the LightGray rectangle might actually be manipulable. In the screen shot above, the mouse pointer was over the marker in the lower right corner.