mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Node editor - Tweak pin positions
This commit is contained in:
parent
2ae1f5f56c
commit
fcf0376a9a
@ -16,6 +16,7 @@
|
||||
<UserControl.KeyBindings>
|
||||
<KeyBinding Command="{CompiledBinding History.Undo}" Gesture="Ctrl+Z"></KeyBinding>
|
||||
<KeyBinding Command="{CompiledBinding History.Redo}" Gesture="Ctrl+Y"></KeyBinding>
|
||||
<KeyBinding Command="{Binding DeleteSelectedNodes}" Gesture="Delete"></KeyBinding>
|
||||
</UserControl.KeyBindings>
|
||||
<paz:ZoomBorder Name="ZoomBorder"
|
||||
Stretch="None"
|
||||
|
||||
@ -103,6 +103,19 @@ public class NodeScriptViewModel : ActivatableViewModelBase
|
||||
set => RaiseAndSetIfChanged(ref _dragViewModel, value);
|
||||
}
|
||||
|
||||
public void DeleteSelectedNodes()
|
||||
{
|
||||
List<NodeViewModel> toRemove = NodeViewModels.Where(vm => vm.IsSelected && !vm.Node.IsDefaultNode && !vm.Node.IsExitNode).ToList();
|
||||
if (!toRemove.Any())
|
||||
return;
|
||||
|
||||
using (_nodeEditorService.CreateCommandScope(NodeScript, "Delete nodes"))
|
||||
{
|
||||
foreach (NodeViewModel node in toRemove)
|
||||
_nodeEditorService.ExecuteCommand(NodeScript, new DeleteNode(NodeScript, node.Node));
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateNodeSelection(List<NodeViewModel> nodes, bool expand, bool invert)
|
||||
{
|
||||
_initialNodeSelection ??= NodeViewModels.Where(vm => vm.IsSelected).ToList();
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
VerticalAlignment="Top"
|
||||
ColumnDefinitions="*,Auto">
|
||||
<TextBlock VerticalAlignment="Center"
|
||||
Margin="5"
|
||||
Margin="10 0 0 0"
|
||||
Text="{CompiledBinding Node.Name}"
|
||||
ToolTip.Tip="{CompiledBinding Node.Description}">
|
||||
</TextBlock>
|
||||
@ -57,7 +57,7 @@
|
||||
</Border>
|
||||
|
||||
|
||||
<Grid Grid.Row="1" ColumnDefinitions="Auto,*,Auto" Margin="5">
|
||||
<Grid Grid.Row="1" ColumnDefinitions="Auto,*,Auto" Margin="4">
|
||||
<StackPanel Grid.Column="0" IsVisible="{CompiledBinding HasInputPins}">
|
||||
<ItemsControl Items="{CompiledBinding InputPinViewModels}" Margin="4 0" />
|
||||
<ItemsControl Items="{CompiledBinding InputPinCollectionViewModels}" />
|
||||
|
||||
@ -2,7 +2,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.PanAndZoom;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
x:Class="Artemis.UI.Screens.VisualScripting.Pins.InputPinCollectionView"
|
||||
x:DataType="pins:PinCollectionViewModel">
|
||||
<StackPanel>
|
||||
<Button Classes="icon-button icon-button-small"
|
||||
<Button Classes="icon-button icon-button-small pin-collection-button"
|
||||
ToolTip.Tip="Add new pin"
|
||||
Command="{CompiledBinding AddPin}">
|
||||
<avalonia:MaterialIcon Kind="Add"></avalonia:MaterialIcon>
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
x:Class="Artemis.UI.Screens.VisualScripting.Pins.OutputPinCollectionView"
|
||||
x:DataType="pins:PinCollectionViewModel">
|
||||
<StackPanel>
|
||||
<Button Classes="icon-button icon-button-small"
|
||||
<Button Classes="icon-button icon-button-small pin-collection-button"
|
||||
ToolTip.Tip="Add new pin"
|
||||
HorizontalAlignment="Right"
|
||||
Command="{CompiledBinding AddPin}">
|
||||
|
||||
@ -6,8 +6,12 @@
|
||||
</Border>
|
||||
</Design.PreviewWith>
|
||||
|
||||
<Style Selector=":is(Button).pin-collection-button">
|
||||
<!-- <Setter Property="Margin" Value="0 2"/> -->
|
||||
</Style>
|
||||
|
||||
<Style Selector="StackPanel#PinContainer">
|
||||
<Setter Property="Height" Value="24" />
|
||||
<Setter Property="Height" Value="26" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
</Style>
|
||||
<Style Selector="StackPanel#PinContainer Border#PinPoint">
|
||||
|
||||
@ -38,7 +38,7 @@ public class DataModelEventNodeCustomViewModel : CustomNodeViewModel
|
||||
|
||||
// Subscribe to node changes
|
||||
_node.WhenAnyValue(n => n.Storage).Subscribe(UpdateDataModelPath).DisposeWith(d);
|
||||
UpdateDataModelPath(_node.Storage);
|
||||
this.WhenAnyValue(vm => vm.DataModelPath).Subscribe(ApplyDataModelPath).DisposeWith(d);
|
||||
|
||||
Disposable.Create(() =>
|
||||
{
|
||||
@ -46,8 +46,6 @@ public class DataModelEventNodeCustomViewModel : CustomNodeViewModel
|
||||
_dataModelPath = null;
|
||||
}).DisposeWith(d);
|
||||
});
|
||||
|
||||
this.WhenAnyValue(vm => vm.DataModelPath).Subscribe(ApplyDataModelPath);
|
||||
}
|
||||
|
||||
public PluginSetting<bool> ShowFullPaths { get; }
|
||||
|
||||
@ -38,7 +38,7 @@ public class DataModelNodeCustomViewModel : CustomNodeViewModel
|
||||
|
||||
// Subscribe to node changes
|
||||
_node.WhenAnyValue(n => n.Storage).Subscribe(UpdateDataModelPath).DisposeWith(d);
|
||||
UpdateDataModelPath(_node.Storage);
|
||||
this.WhenAnyValue(vm => vm.DataModelPath).Subscribe(ApplyDataModelPath).DisposeWith(d);
|
||||
|
||||
Disposable.Create(() =>
|
||||
{
|
||||
@ -46,8 +46,6 @@ public class DataModelNodeCustomViewModel : CustomNodeViewModel
|
||||
_dataModelPath = null;
|
||||
}).DisposeWith(d);
|
||||
});
|
||||
|
||||
this.WhenAnyValue(vm => vm.DataModelPath).Subscribe(ApplyDataModelPath);
|
||||
}
|
||||
|
||||
public PluginSetting<bool> ShowFullPaths { get; }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user