Auto-sizing behavior has bad side effect

If you run GoWpfDemo, select the Logic Circuit, hit Ctrl+A to select all the shapes, and drag them to the right so that they are off of the canvas, they automatically slide back to the left, undoing what the user did.

I think I understand why: dragging them to the right grows the canvas. But when they’re dropped, GoXam sees there’s a lot of unused space on the left and it automatically shrinks the canvas. If you auto-grow the canvas, it makes sense that you need a strategy for discarding no-longer-used space.

But one of our users sees this as a bug. He moved the shapes to the right to get them out of the way and free up some space to start dropping new shapes into. Every time he tries to make some space, GoXam thwarts him.

Is there a way to alter the auto-shrink behavior?

Thanks,
Bob

If the user drags all of the nodes a little bit to the right, the Diagram.Panel is not automatically scrolled. This leaves some empty space on the left side.

However, if the user drags everything completely or mostly outside the viewport, then yes, the Diagram.Panel will automatically scroll to make something visible. This is because too many users complained about how they couldn’t see anything, and making sure the panel shows a valid part of the Diagram.Panel.DiagramBounds made a lot of sense.

You’ll notice that Visio does a similar thing when the user drags stuff off of a page.

But you get to control all of that by overriding methods on DiagramPanel, in this case the OnBoundsAlignmentChanged method.

Thanks, Walter.

Can you post the current implementation of OnBoundsAlignmentChanged?

Not in a manner that you could easily make use of it.
I suggest you detect and handle the cases that you care about handling differently, and otherwise call the base method for the standard behavior.

I suspect that the cases that you want to handle specially are those where the old viewport bounds are not entirely within the new diagram bounds. But I could be wrong about that.