追加缩进修正逻辑

This commit is contained in:
zengwenjie
2025-09-17 12:08:20 +08:00
parent 1df6b8862a
commit 29dd0721f1
2 changed files with 23 additions and 0 deletions

View File

@@ -29,6 +29,9 @@ namespace Deedy.Activity
[TemplatePart(Name = PART_StateDecorator, Type = typeof(ViewerStateDecorator))] [TemplatePart(Name = PART_StateDecorator, Type = typeof(ViewerStateDecorator))]
public class ActionViewer : Control, IActionViewer public class ActionViewer : Control, IActionViewer
{ {
public static double IndentRuler { get; set; } = 30;
public const string PART_ItemsContainer = "PART_ItemsContainer"; public const string PART_ItemsContainer = "PART_ItemsContainer";
public const string PART_TitleContainer = "PART_TitleContainer"; public const string PART_TitleContainer = "PART_TitleContainer";
public const string PART_StateDecorator = "PART_StateDecorator"; public const string PART_StateDecorator = "PART_StateDecorator";
@@ -509,6 +512,19 @@ namespace Deedy.Activity
public static readonly DependencyPropertyKey MarginCorrection_TopBottomPropertyKey = public static readonly DependencyPropertyKey MarginCorrection_TopBottomPropertyKey =
DependencyProperty.RegisterReadOnly("MarginCorrection_TopBottom", typeof(Thickness), typeof(ActionViewer), new PropertyMetadata(new Thickness())); DependencyProperty.RegisterReadOnly("MarginCorrection_TopBottom", typeof(Thickness), typeof(ActionViewer), new PropertyMetadata(new Thickness()));
public static readonly DependencyProperty MarginCorrection_TopBottomProperty = MarginCorrection_TopBottomPropertyKey.DependencyProperty; public static readonly DependencyProperty MarginCorrection_TopBottomProperty = MarginCorrection_TopBottomPropertyKey.DependencyProperty;
/// <summary>
/// 缩进边距修正
/// </summary>
public Thickness MarginCorrection_Indentation
{
get { return (Thickness)GetValue(MarginCorrection_IndentationProperty); }
protected internal set { SetValue(MarginCorrection_IndentationPropertyKey, value); }
}
public static readonly DependencyPropertyKey MarginCorrection_IndentationPropertyKey =
DependencyProperty.RegisterReadOnly("MarginCorrection_Indentation", typeof(Thickness), typeof(ActionViewer), new PropertyMetadata(new Thickness()));
public static readonly DependencyProperty MarginCorrection_IndentationProperty = MarginCorrection_IndentationPropertyKey.DependencyProperty;
/// <summary> /// <summary>
/// 动作节点 /// 动作节点
/// </summary> /// </summary>
@@ -633,6 +649,9 @@ namespace Deedy.Activity
switch (e.PropertyName) switch (e.PropertyName)
{ {
//TODO处理托管的IActionElement节点的属性变更 //TODO处理托管的IActionElement节点的属性变更
case nameof(IElement.DepthLevel):
this.MarginCorrection_Indentation = new Thickness(ActionViewer.IndentRuler * this.ActionElement.DepthLevel, 0, 0, 0);
break;
case nameof(IActionElement.InstantInfo): case nameof(IActionElement.InstantInfo):
this.InstantInfo = this.ActionElement.InstantInfo; this.InstantInfo = this.ActionElement.InstantInfo;
break; break;

View File

@@ -14,6 +14,9 @@ namespace Deedy.Activity
{ {
public interface IActionViewer : IActivity, INotifyPropertyChanged public interface IActionViewer : IActivity, INotifyPropertyChanged
{ {
public static double IndentRuler { get; set; }
public static double LineHeight { get; set; }
[AllowNull] [AllowNull]
public IActionElement ActionElement { get; set; } public IActionElement ActionElement { get; set; }
public Visibility ShowBreakHandle { get; } public Visibility ShowBreakHandle { get; }
@@ -46,6 +49,7 @@ namespace Deedy.Activity
public Thickness MarginCorrection_Top { get; } public Thickness MarginCorrection_Top { get; }
public Thickness MarginCorrection_Bottom { get; } public Thickness MarginCorrection_Bottom { get; }
public Thickness MarginCorrection_TopBottom { get; } public Thickness MarginCorrection_TopBottom { get; }
public Thickness MarginCorrection_Indentation { get; }
public ImageSource ElementIcon { get; } public ImageSource ElementIcon { get; }
[AllowNull] [AllowNull]
public StyleSelector StyleSelector { get; set; } public StyleSelector StyleSelector { get; set; }