画面の寸法と不透明度の数値を1か所にまとめる
このコミットが含まれているのは:
7ファイル変更
+27
-16
検索条件に一致するファイルはありません
@@ -4,15 +4,15 @@ using System.Windows.Data;
|
||||
|
||||
namespace UndoTree;
|
||||
|
||||
public sealed class DoubleToGridLengthConverter : IValueConverter
|
||||
internal sealed class DoubleToGridLengthConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
=> value is double height && !double.IsNaN(height) && !double.IsInfinity(height)
|
||||
? new GridLength(height)
|
||||
: new GridLength(160);
|
||||
: new GridLength(UndoTreeLayout.DefaultDetailsHeight);
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
=> value is GridLength gridLength && gridLength.IsAbsolute
|
||||
? gridLength.Value
|
||||
: 160d;
|
||||
: UndoTreeLayout.DefaultDetailsHeight;
|
||||
}
|
||||
@@ -15,5 +15,5 @@ internal class UndoTreeDetailItemViewModel(string text, string detail, int level
|
||||
|
||||
public string Display => UndoTreeText.WithDetail(Text, Detail);
|
||||
|
||||
public Thickness Margin => new(Level * 16, 0, 0, 0);
|
||||
public Thickness Margin => new(Level * UndoTreeLayout.IndentWidth, 0, 0, 0);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace UndoTree;
|
||||
|
||||
internal static class UndoTreeLayout
|
||||
{
|
||||
public const double DefaultDetailsHeight = 160;
|
||||
public const double MinDetailsHeight = 60;
|
||||
public const double MaxDetailsHeight = 600;
|
||||
public const double MinTreeHeight = 60;
|
||||
public const double IndentWidth = 16;
|
||||
public const int FilterDelayMilliseconds = 150;
|
||||
public const double PathOpacity = 1;
|
||||
public const double RedoOpacity = 0.75;
|
||||
public const double OtherBranchOpacity = 0.55;
|
||||
}
|
||||
@@ -146,7 +146,7 @@ internal class UndoTreeNodeViewModel : Bindable
|
||||
|
||||
public int Level { get; set => Set(ref field, value, nameof(Level), nameof(Margin)); }
|
||||
|
||||
public Thickness Margin => new(Level * 16, 0, 0, 0);
|
||||
public Thickness Margin => new(Level * UndoTreeLayout.IndentWidth, 0, 0, 0);
|
||||
|
||||
public bool IsExpanded
|
||||
{
|
||||
@@ -175,7 +175,7 @@ internal class UndoTreeNodeViewModel : Bindable
|
||||
|
||||
public bool IsRedoable { get; set => Set(ref field, value, nameof(IsRedoable), nameof(Opacity)); }
|
||||
|
||||
public double Opacity => IsCurrent || IsOnPath ? 1 : IsRedoable ? 0.75 : 0.55;
|
||||
public double Opacity => IsCurrent || IsOnPath ? UndoTreeLayout.PathOpacity : IsRedoable ? UndoTreeLayout.RedoOpacity : UndoTreeLayout.OtherBranchOpacity;
|
||||
|
||||
public event EventHandler? ExpandRequested;
|
||||
|
||||
|
||||
@@ -4,5 +4,5 @@ internal record UndoTreeState
|
||||
{
|
||||
public bool IsDetailsVisible { get; init; } = true;
|
||||
|
||||
public double DetailsHeight { get; init; } = 160;
|
||||
public double DetailsHeight { get; init; } = UndoTreeLayout.DefaultDetailsHeight;
|
||||
}
|
||||
@@ -40,13 +40,13 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition MinHeight="60"/>
|
||||
<RowDefinition MinHeight="{x:Static local:UndoTreeLayout.MinTreeHeight}"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="{Binding DetailsHeight, Converter={StaticResource DoubleToGridLengthConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
|
||||
<RowDefinition.Style>
|
||||
<Style TargetType="RowDefinition">
|
||||
<Setter Property="MinHeight" Value="60"/>
|
||||
<Setter Property="MaxHeight" Value="600"/>
|
||||
<Setter Property="MinHeight" Value="{x:Static local:UndoTreeLayout.MinDetailsHeight}"/>
|
||||
<Setter Property="MaxHeight" Value="{x:Static local:UndoTreeLayout.MaxDetailsHeight}"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsDetailsVisible}" Value="False">
|
||||
<Setter Property="MaxHeight" Value="0"/>
|
||||
@@ -74,7 +74,7 @@
|
||||
<Button Grid.Column="3" Content="{DynamicResource {x:Static icons:IconKeys.ExpandAll}}" Command="{Binding ExpandAllCommand}" ToolTip="{x:Static local:Texts.ExpandAll}" Style="{StaticResource ToolBarButtonStyle}"/>
|
||||
<Button Grid.Column="4" Content="{DynamicResource {x:Static icons:IconKeys.CollapseAll}}" Command="{Binding CollapseAllCommand}" ToolTip="{x:Static local:Texts.CollapseAll}" Style="{StaticResource ToolBarButtonStyle}"/>
|
||||
<TextBox x:Name="filterTextBox" Grid.Column="5" Padding="3,0,3,0" VerticalContentAlignment="Center"
|
||||
Text="{Binding Filter.SearchText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Delay=150}"/>
|
||||
Text="{Binding Filter.SearchText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Delay={x:Static local:UndoTreeLayout.FilterDelayMilliseconds}}"/>
|
||||
<TextBlock Grid.Column="5" Text="{x:Static local:Texts.Filter}" Foreground="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" VerticalAlignment="Center" Margin="6,0,3,0" IsHitTestVisible="False">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
|
||||
@@ -176,7 +176,7 @@
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ToggleButton Grid.Column="0" Width="16" Height="16" Margin="0,0,4,0" IsChecked="{Binding IsExpanded, Mode=TwoWay}">
|
||||
<ToggleButton Grid.Column="0" Width="{x:Static local:UndoTreeLayout.IndentWidth}" Height="{x:Static local:UndoTreeLayout.IndentWidth}" Margin="0,0,4,0" IsChecked="{Binding IsExpanded, Mode=TwoWay}">
|
||||
<ToggleButton.Style>
|
||||
<Style TargetType="ToggleButton">
|
||||
<Setter Property="Visibility" Value="Hidden"/>
|
||||
|
||||
@@ -13,9 +13,6 @@ namespace UndoTree;
|
||||
|
||||
internal class UndoTreeViewModel : Bindable, IToolViewModel, ITimelineToolViewModel, IDisposable
|
||||
{
|
||||
const double MinDetailsHeight = 60;
|
||||
const double MaxDetailsHeight = 600;
|
||||
|
||||
readonly HashSet<UndoTreeNodeViewModel> subscribedNodes = new(ReferenceEqualityComparer.Instance);
|
||||
UndoTreeHistory? history;
|
||||
Timeline? timeline;
|
||||
@@ -93,7 +90,7 @@ internal class UndoTreeViewModel : Bindable, IToolViewModel, ITimelineToolViewMo
|
||||
}
|
||||
}
|
||||
|
||||
public double DetailsHeight { get; set => Set(ref field, double.IsNaN(value) ? 160 : Math.Clamp(value, MinDetailsHeight, MaxDetailsHeight)); } = 160;
|
||||
public double DetailsHeight { get; set => Set(ref field, double.IsNaN(value) ? UndoTreeLayout.DefaultDetailsHeight : Math.Clamp(value, UndoTreeLayout.MinDetailsHeight, UndoTreeLayout.MaxDetailsHeight)); } = UndoTreeLayout.DefaultDetailsHeight;
|
||||
|
||||
public bool IsConflictSkip => UndoTreeSettings.Default.ConflictPolicy == ConflictPolicy.Skip;
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする