I have come across an issue when I draw a link from an object:
rotate the object:
then undo, I get this:
Any suggestion as to what might be causing this? Or how I can fix it?
Thanks
Ryan
I have come across an issue when I draw a link from an object:
rotate the object:
then undo, I get this:
Any suggestion as to what might be causing this? Or how I can fix it?
Thanks
Ryan
That’s odd. Can you reproduce the problem in the Draggable Links sample?
No I wasn’t able to replicate it in the sample.
Though with further testing I have been able to fix the problem…
if (((Northwoods.GoXam.Model.UndoManager.CompoundEdit)this.Diagram.Model.UndoManager.EditToUndo).Name == “Rotate”)
{
<span =“Apple-tab-span” style=“white-space:pre”> base.Undo();
<span =“Apple-tab-span” style=“white-space:pre”>
<span =“Apple-tab-span” style=“white-space:pre”> foreach (PipeData data in EditPartsData.Where(x => x is PipeData))
<span =“Apple-tab-span” style=“white-space:pre”> {
<span =“Apple-tab-span” style=“white-space:pre”> Link link = this.Diagram.Links.Where(x => x.Data == data).FirstOrDefault();
<span =“Apple-tab-span” style=“white-space:pre”> if (link.Route.Points != data.Points)
<span =“Apple-tab-span” style=“white-space:pre”> link.Route.Points = data.Points.ToList();
<span =“Apple-tab-span” style=“white-space:pre”> }
}
Note - EditPartsData contains the data’s of each of the nodes/links involved in the EditToUndo
That may be a work-around, but it doesn’t explain the behavior in the first place.
What other things are you doing around a transaction or an undo or a redo?
This is what our Undo currently looks like:
public override void Undo()
{
EditPartsData = new List<object>();<span style="font-size: 12px; line-height: 1.4;"> </span>
if (this.Diagram.Model.UndoManager.EditToUndo == null) return;
foreach (ModelChangedEventArgs edit in ((Northwoods.GoXam.Model.UndoManager.CompoundEdit)this.Diagram.Model.UndoManager.EditToUndo).Edits)
EditPartsData.Add(edit.Data);
if (((Northwoods.GoXam.Model.UndoManager.CompoundEdit)this.Diagram.Model.UndoManager.EditToUndo).Name == "Rotate")
{
base.Undo();
foreach (PipeData data in EditPartsData.Where(x => x is PipeData))
{
Link link = this.Diagram.Links.Where(x => x.Data == data).FirstOrDefault();
if (link.Route.Points != data.Points)
<span style="font-size: 12px; line-height: 1.4;">link.Route.Points = data.Points.ToList();</span><span style="font-size: 12px; line-height: 1.4;"> </span>
}
}
else
base.Undo();<span style="font-size: 12px; line-height: 1.4;"> </span>
}
Hmm, that looks like it is entirely for the purpose of implementing the work-around.
Are there are warnings or errors in the Output Window (trace listeners) at any time during the editing process or the undo or the redo?
Have you overridden any other methods?
Nothing in the output window… Though one thing that sticks out to me is that after the undo, the link is still going to the position of where the anchor used to be. Is it possible that the route points are being recomputed before the object is rotated back to its previous position?
We have overridden large portions of the base code, in this case I would assume the most relevant would be the Link.Route, but when I switch back to the base Route the problem remains. Any suggestion for other areas to look at?
Do you use a custom PartManager, like the one in the Draggable Link sample, that sets UpdatesRouteDataPoints and overrides UpdateRouteDataPoints, and perhaps does the other overrides too?
Yes we do have a custom PartManager. UpdatesRouteDataPoints is true, and we’ve copied the UpdateRouteDataPoints from the sample. We’ve also overridden OnLinkAdded, OnLinkRemoving, OnNodeAdded, and OnNodeRemoving.