I'm writing an OnShapeClick method that (among other things) should change the Color of the selected shape. I am defining shapes as such:
<DiagramShapes>
@foreach (Node node in Nodes)
{
<DiagramShape Id="@node.LinkID" >
<DiagramShapeContent Text="@node.GetDisplayName()" />
<DiagramShapeFill Color="@node.GetColor()"/>
</DiagramShape>
}
</DiagramShapes>In OnShapeClick, I am updating the Color by changing a field for the specified node that results in node.GetColor() returning a new Value, and this works.
async Task OnPersonClick(DiagramShapeClickEventArgs Args)
{
foreach (Node node in Nodes)
{
if (node.LinkID.Equals(Args.Id))
node.State = SelectedState.True;
else
node.State = SelectedState.False;
}
}The issue is that when the Diagram is re-rendered, the positions of all the shapes are recalculated. resulting in any Shapes that the user has dragged out of position to revert to their original position, or in the case of the Force Diagram, a complete reshuffle of the Shapes in the Diagram. This is undesired behavior.
In short, how do I update the Color (or any property) of a Diagram Shape while maintaining the current positions of all shapes within the Diagram?
