移动轨道清除功能至右键菜单
This commit is contained in:
@@ -84,6 +84,7 @@
|
||||
<s:String x:Key="Str_Animation">Animation</s:String>
|
||||
<s:String x:Key="Str_AppendTrack">Add</s:String>
|
||||
<s:String x:Key="Str_InsertTrack">Insert</s:String>
|
||||
<s:String x:Key="Str_ClearTrack">Clear</s:String>
|
||||
|
||||
<s:String x:Key="Str_Debug">Debug</s:String>
|
||||
<s:String x:Key="Str_DebugTexture">Texture</s:String>
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
<s:String x:Key="Str_Animation">アニメーション</s:String>
|
||||
<s:String x:Key="Str_AppendTrack">追加</s:String>
|
||||
<s:String x:Key="Str_InsertTrack">挿入</s:String>
|
||||
<s:String x:Key="Str_ClearTrack">削除</s:String>
|
||||
|
||||
<s:String x:Key="Str_Debug">デバッグ</s:String>
|
||||
<s:String x:Key="Str_DebugTexture">テクスチャ</s:String>
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
<s:String x:Key="Str_Animation">动画</s:String>
|
||||
<s:String x:Key="Str_AppendTrack">添加</s:String>
|
||||
<s:String x:Key="Str_InsertTrack">插入</s:String>
|
||||
<s:String x:Key="Str_ClearTrack">删除</s:String>
|
||||
|
||||
<s:String x:Key="Str_Debug">调试</s:String>
|
||||
<s:String x:Key="Str_DebugTexture">Texture</s:String>
|
||||
|
||||
@@ -384,6 +384,27 @@ namespace SpineViewer.ViewModels.MainWindow
|
||||
);
|
||||
private RelayCommand<IList?>? _cmd_InsertTrack;
|
||||
|
||||
public RelayCommand<IList?>? Cmd_ClearTrack => _cmd_ClearTrack ??= new(
|
||||
args =>
|
||||
{
|
||||
if (_selectedObjects.Length <= 0) return;
|
||||
if (args is null) return;
|
||||
if (args.Count <= 0) return;
|
||||
|
||||
foreach (var vm in args.OfType<AnimationTrackViewModel>())
|
||||
foreach (var sp in _selectedObjects)
|
||||
sp.ClearTrack(vm.TrackIndex);
|
||||
},
|
||||
args =>
|
||||
{
|
||||
if (_selectedObjects.Length <= 0) return false;
|
||||
if (args is null) return false;
|
||||
if (args.Count <= 0) return false;
|
||||
return true;
|
||||
}
|
||||
);
|
||||
private RelayCommand<IList?>? _cmd_ClearTrack;
|
||||
|
||||
public bool? DebugTexture
|
||||
{
|
||||
get
|
||||
@@ -806,9 +827,6 @@ namespace SpineViewer.ViewModels.MainWindow
|
||||
}
|
||||
}
|
||||
|
||||
public RelayCommand Cmd_ClearTrack => _cmd_ClearTrack ??= new(() => { foreach (var sp in _spines) sp.ClearTrack(_trackIndex); });
|
||||
private RelayCommand? _cmd_ClearTrack;
|
||||
|
||||
public ReadOnlyCollection<string> AnimationNames => _animationNames.AsReadOnly();
|
||||
|
||||
public int TrackIndex => _trackIndex;
|
||||
|
||||
@@ -568,6 +568,9 @@
|
||||
<MenuItem Header="{DynamicResource Str_InsertTrack}"
|
||||
Command="{Binding Cmd_InsertTrack}"
|
||||
CommandParameter="{Binding PlacementTarget.SelectedItems, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"/>
|
||||
<MenuItem Header="{DynamicResource Str_ClearTrack}"
|
||||
Command="{Binding Cmd_ClearTrack}"
|
||||
CommandParameter="{Binding PlacementTarget.SelectedItems, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"/>
|
||||
</ContextMenu>
|
||||
</ListBox.ContextMenu>
|
||||
|
||||
@@ -578,16 +581,12 @@
|
||||
<ColumnDefinition Width="Auto" SharedSizeGroup="Col0"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto" SharedSizeGroup="Col2"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Grid.Column="0" Content="{Binding TrackIndex}" HorizontalContentAlignment="Left"/>
|
||||
<ComboBox Grid.Column="1" SelectedValue="{Binding AnimationName}" ItemsSource="{Binding AnimationNames}"/>
|
||||
<Label Grid.Column="2"
|
||||
Content="{Binding AnimationDuration}"
|
||||
ContentStringFormat="{}{0:F3} s"/>
|
||||
<Button Grid.Column="3"
|
||||
Command="{Binding Cmd_ClearTrack}"
|
||||
hc:IconElement.Geometry="{StaticResource Geo_TrashXmark}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
|
||||
Reference in New Issue
Block a user