#0026 图像工具箱新增移动和删除
This commit is contained in:
@@ -56,6 +56,8 @@ namespace XplorePlane.ViewModels
|
||||
SaveAsPipelineCommand = new DelegateCommand(async () => await SaveAsPipelineAsync());
|
||||
DeletePipelineCommand = new DelegateCommand(async () => await DeletePipelineAsync());
|
||||
LoadPipelineCommand = new DelegateCommand(async () => await LoadPipelineAsync());
|
||||
MoveNodeUpCommand = new DelegateCommand<PipelineNodeViewModel>(MoveNodeUp);
|
||||
MoveNodeDownCommand = new DelegateCommand<PipelineNodeViewModel>(MoveNodeDown);
|
||||
}
|
||||
|
||||
// ── State Properties ──────────────────────────────────────────
|
||||
@@ -135,6 +137,8 @@ namespace XplorePlane.ViewModels
|
||||
public DelegateCommand SaveAsPipelineCommand { get; }
|
||||
public DelegateCommand DeletePipelineCommand { get; }
|
||||
public DelegateCommand LoadPipelineCommand { get; }
|
||||
public DelegateCommand<PipelineNodeViewModel> MoveNodeUpCommand { get; }
|
||||
public DelegateCommand<PipelineNodeViewModel> MoveNodeDownCommand { get; }
|
||||
|
||||
// ── Command Implementations ───────────────────────────────────
|
||||
|
||||
@@ -197,6 +201,26 @@ namespace XplorePlane.ViewModels
|
||||
TriggerDebouncedExecution();
|
||||
}
|
||||
|
||||
private void MoveNodeUp(PipelineNodeViewModel node)
|
||||
{
|
||||
if (node == null) return;
|
||||
int index = PipelineNodes.IndexOf(node);
|
||||
if (index <= 0) return;
|
||||
PipelineNodes.Move(index, index - 1);
|
||||
RenumberNodes();
|
||||
TriggerDebouncedExecution();
|
||||
}
|
||||
|
||||
private void MoveNodeDown(PipelineNodeViewModel node)
|
||||
{
|
||||
if (node == null) return;
|
||||
int index = PipelineNodes.IndexOf(node);
|
||||
if (index < 0 || index >= PipelineNodes.Count - 1) return;
|
||||
PipelineNodes.Move(index, index + 1);
|
||||
RenumberNodes();
|
||||
TriggerDebouncedExecution();
|
||||
}
|
||||
|
||||
private void ReorderOperator(PipelineReorderArgs args)
|
||||
{
|
||||
if (args == null) return;
|
||||
|
||||
@@ -161,10 +161,11 @@
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid MinHeight="48">
|
||||
<Grid x:Name="NodeRoot" MinHeight="48">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="44" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 连接线列:上半段 + 下半段 -->
|
||||
@@ -196,11 +197,38 @@
|
||||
Margin="6,0,0,0"
|
||||
FontFamily="Microsoft YaHei UI" FontSize="12"
|
||||
Text="{Binding DisplayName}" />
|
||||
|
||||
<!-- 操作按钮:上移 / 下移 / 删除(悬停显示) -->
|
||||
<StackPanel x:Name="NodeActions"
|
||||
Grid.Column="2"
|
||||
Orientation="Horizontal"
|
||||
VerticalAlignment="Center"
|
||||
Margin="0,0,4,0"
|
||||
Visibility="Collapsed">
|
||||
<Button Content="▲" ToolTip="上移" Width="22" Height="22"
|
||||
Margin="1,0" FontSize="10" Cursor="Hand"
|
||||
Background="Transparent" BorderBrush="#cdcbcb" BorderThickness="1"
|
||||
Command="{Binding DataContext.MoveNodeUpCommand, RelativeSource={RelativeSource AncestorType=ListBox}}"
|
||||
CommandParameter="{Binding}" />
|
||||
<Button Content="▼" ToolTip="下移" Width="22" Height="22"
|
||||
Margin="1,0" FontSize="10" Cursor="Hand"
|
||||
Background="Transparent" BorderBrush="#cdcbcb" BorderThickness="1"
|
||||
Command="{Binding DataContext.MoveNodeDownCommand, RelativeSource={RelativeSource AncestorType=ListBox}}"
|
||||
CommandParameter="{Binding}" />
|
||||
<Button Content="✕" ToolTip="删除" Width="22" Height="22"
|
||||
Margin="1,0" FontSize="10" Cursor="Hand"
|
||||
Background="Transparent" BorderBrush="#E05050" BorderThickness="1"
|
||||
Command="{Binding DataContext.RemoveOperatorCommand, RelativeSource={RelativeSource AncestorType=ListBox}}"
|
||||
CommandParameter="{Binding}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding Order}" Value="0">
|
||||
<Setter TargetName="TopLine" Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
<Trigger SourceName="NodeRoot" Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="NodeActions" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
|
||||
Reference in New Issue
Block a user