Fix auto connecting nodes

This commit is contained in:
Robert committed 2023-04-07 16:18:07 +02:00
1 parent 73933ee324
commit 88558efcb1
4 files changed
+41 -17

No files matched your search

@@ -156,7 +156,21 @@
<TextBlock Grid.Row="0" Classes="h5 no-margin">Release notes</TextBlock>
<Separator Grid.Row="1" Classes="card-separator" />
<avalonia:MarkdownScrollViewer Grid.Row="2" Markdown="{CompiledBinding Changelog}" MarkdownStyleName="FluentAvalonia"/>
<avalonia:MarkdownScrollViewer Grid.Row="2" Markdown="{CompiledBinding Changelog}" MarkdownStyleName="FluentAvalonia">
<avalonia:MarkdownScrollViewer.Styles>
<Style Selector="ctxt|CHyperlink">
<Setter Property="Foreground" Value="{DynamicResource SystemAccentColorLight3}" />
</Style>
<Style Selector="ctxt|CHyperlink:pointerover">
<Setter Property="Foreground" Value="{DynamicResource SystemAccentColorLight1}" />
</Style>
<Style Selector="Grid.List">
<Style.Setters>
<Setter Property="Margin" Value="20,0,0,0"/>
</Style.Setters>
</Style>
</avalonia:MarkdownScrollViewer.Styles>
</avalonia:MarkdownScrollViewer>
</Grid>
</Border>
</Grid>
@@ -50,7 +50,6 @@ public class NodePickerViewModel : ActivatableViewModelBase
this.WhenActivated(d =>
{
SearchText = null;
TargetPin = null;
nodeSourceList.Edit(list =>
{
@@ -59,7 +58,11 @@ public class NodePickerViewModel : ActivatableViewModelBase
});
IsVisible = true;
Disposable.Create(() => IsVisible = false).DisposeWith(d);
Disposable.Create(() =>
{
IsVisible = false;
TargetPin = null;
}).DisposeWith(d);
});
}
@@ -102,6 +105,7 @@ public class NodePickerViewModel : ActivatableViewModelBase
node.Y = Math.Round(Position.Y / 10d, 0, MidpointRounding.AwayFromZero) * 10d;
if (TargetPin != null)
{
using (_nodeEditorService.CreateCommandScope(_nodeScript, "Create node for pin"))
{
_nodeEditorService.ExecuteCommand(_nodeScript, new AddNode(_nodeScript, node));
@@ -114,6 +118,7 @@ public class NodePickerViewModel : ActivatableViewModelBase
if (source != null)
_nodeEditorService.ExecuteCommand(_nodeScript, new ConnectPins(source, TargetPin));
}
}
else
_nodeEditorService.ExecuteCommand(_nodeScript, new AddNode(_nodeScript, node));
}