Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…iagrams into develop
  • Loading branch information
zHaytam committed Oct 23, 2023
2 parents 9836fa3 + 12ea521 commit c15bec5
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions site/Site/Components/Landing/LandingShowcaseDiagram.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,24 @@ private void OnLinkAdded(BaseLinkModel link)
link.TargetChanged += OnLinKTargetChanged;
}

private void OnLinKTargetChanged(BaseLinkModel link, Anchor? oldTarget, Anchor? newTarget)
private void OnLinKTargetChanged(BaseLinkModel link, Anchor oldTarget, Anchor newTarget)
{
if (oldTarget == null && newTarget != null) // First attach
// only refresh on the first time the link is attached
if (oldTarget is PositionAnchor
&& newTarget.Model is PortModel targetModel
&& link.IsAttached)
{
(newTarget.Model as PortModel)!.Parent.Refresh();
targetModel.Parent.Refresh();
}
}

private void OnLinkRemoved(BaseLinkModel link)
{
(link.Source.Model as PortModel)!.Parent.Refresh();
if (link.Target != null) (link.Target.Model as PortModel)!.Parent.Refresh();
if (link.Target is SinglePortAnchor anchor && anchor.Model is PortModel portModel)
{
portModel.Parent.Refresh();
}
link.TargetChanged -= OnLinKTargetChanged;
}
}

0 comments on commit c15bec5

Please sign in to comment.