Active DraggingTool.IsRealtime and auto scroll


I deactivated DraggingTool.IsRealtime within my DraggingTool to accelerate the moving of my nodes. If I deactivate IsRealTime the diagram bounds of the panel will not be resized automatically if I move it to the diagram one of the diaggram side. This only works with activated IsRealTime. Is there any solution to get a non real time but self resizing diagram panel?



Yes, that’s because the user can only scroll to areas defined by the Diagram.Panel.DiagramBounds, which is the area occupied by the Parts plus some Padding. If the user is not actually moving some nodes outside of the original DiagramBounds, the DiagramBounds won’t be extended.

However, there might be a way to customize the DraggingTool to pretend to make the DiagramBounds bigger by temporarily setting Diagram.Panel.FixedBounds. If I get a chance I’ll try to implement this later today.

public class AutoDraggingTool : DraggingTool { public AutoDraggingTool() { this.IsRealtime = false; }</p><p> protected override void DragOver(Point pt, bool moving, bool copying) { DiagramPanel panel = this.Diagram.Panel; Rect b = panel.DiagramBounds; b.Union(new Rect(pt.X-200, pt.Y-200, 400, 400)); panel.FixedBounds = b; base.DragOver(pt, moving, copying); }</p><p> public override void DoDeactivate() { DiagramPanel panel = this.Diagram.Panel; panel.FixedBounds = new Rect(Double.NaN, Double.NaN, Double.NaN, Double.NaN); base.DoDeactivate(); } }

Install by replacing the Diagram.DraggingTool with an instance of AutoDraggingTool.

That works pretty fine. Thank you very much! :)