Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic UndoManager - Resize Nodes programmatically (Read 2015 times)
due
YaBB Newbies
*
Offline



Posts: 27
Joined: Jun 20th, 2007
UndoManager - Resize Nodes programmatically
Apr 17th, 2008 at 12:53pm
Print Post  
The undo manager does not record the resizing of nodes via ResizeToFitText(FitSize.KeepRatio) automatically.

If you use a ChangeItemCmd based on the modified node it will be recorded, but subsequent changings on connected links will be not registered. These changings are done by resize method.

However, undo calls will result in inconsistent charts (links are displayed unconnected or ends up anywhere in the chart due to the different origin/destination node size).

How can I handle this?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: UndoManager - Resize Nodes programmatically
Reply #1 - Apr 17th, 2008 at 1:17pm
Print Post  
Create ChangeItemCmds for the links, and add all commands to a composite one.
  
Back to top
 
IP Logged
 
due
YaBB Newbies
*
Offline



Posts: 27
Joined: Jun 20th, 2007
Re: UndoManager - Resize Nodes programmatically
Reply #2 - Apr 18th, 2008 at 11:51am
Print Post  
No, sorry, it doesn't work.

We did a couple of tests. It is remarkable that the problem will not occur, if you define an anchor pattern (DiagramNode.AnchorPattern).
Otherwise, links are displayed broken after undo action, although ChangeItemCmds for the resized node and also for links created and added to a composite command.

Diagram settings:
Code
Select All
	this.diagram.AllowLinksRepeat = false;
	this.diagram.AllowSelfLoops = false;
	this.diagram.AllowSplitLinks = true;
	this.diagram.AutoResize = MindFusion.Diagramming.AutoResize.AllDirections;
	this.diagram.BackBrush = new MindFusion.Drawing.SolidBrush("#FFFFFFFF");
	this.diagram.DynamicLinks = true;
	this.diagram.HitTestPriority = MindFusion.Diagramming.HitTestPriority.ZOrder;
	this.diagram.LinkBrush = new MindFusion.Drawing.SolidBrush("#FF000000");
	this.diagram.LinkHeadShape = MindFusion.Diagramming.ArrowHead.Triangle;
	this.diagram.LinkHeadShapeSize = 2.5F;
	this.diagram.LinksSnapToBorders = true;
	this.diagram.LinkTextStyle = MindFusion.Diagramming.LinkTextStyle.OverLongestSegment;
	this.diagram.MergeThreshold = 1F;
	this.diagram.RestrictItemsToBounds = MindFusion.Diagramming.RestrictToBounds.InsideOnly;
	this.diagram.RoundRectFactor = 0.35F;
	this.diagram.SelectedItemHandlesColor = System.Drawing.Color.White;
	this.diagram.ShadowColor = System.Drawing.Color.LightGray;
	this.diagram.ShapeBrush = new MindFusion.Drawing.SolidBrush("#FFFFFFFF");
	this.diagram.ShapeHandlesStyle = MindFusion.Diagramming.HandlesStyle.SquareHandles2;
	this.diagram.ShapeText = "person";
	this.diagram.ShowDisabledHandles = false;
	this.diagram.SnapToAnchor = MindFusion.Diagramming.SnapToAnchor.OnCreateOrModify; 

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: UndoManager - Resize Nodes programmatically
Reply #3 - Apr 22nd, 2008 at 9:38am
Print Post  
The DiagramNode.Resize method saves undo info for the resized node and the links modified with it, so to be consistent I suppose we should implement that for ResizeToFitText as well. For now, call ResizeToFitText to find out the new size, set back the original one, and call Resize - that should create the correct Change commands. We'll try to implement that for ResizeToFit in V5.1.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint