浏览代码

Fixed EndToStart issues

Tig 1 年之前
父节点
当前提交
e59311b46b
共有 3 个文件被更改,包括 11 次插入10 次删除
  1. 5 0
      Terminal.Gui/Drawing/Aligner.cs
  2. 1 5
      Terminal.Gui/View/Layout/Dim.cs
  3. 5 5
      Terminal.Gui/View/Layout/PosAlign.cs

+ 5 - 0
Terminal.Gui/Drawing/Aligner.cs

@@ -121,6 +121,9 @@ public class Aligner : INotifyPropertyChanged
 
 
                     case AlignmentModes.EndToStart:
                     case AlignmentModes.EndToStart:
                         return End (in sizesCopy, containerSize, totalItemsSize, maxSpaceBetweenItems, spacesToGive).Reverse ().ToArray ();
                         return End (in sizesCopy, containerSize, totalItemsSize, maxSpaceBetweenItems, spacesToGive).Reverse ().ToArray ();
+
+                    case AlignmentModes.EndToStart | AlignmentModes.IgnoreFirstOrLast:
+                        return IgnoreFirst (in sizesCopy, containerSize, totalItemsSize, maxSpaceBetweenItems, spacesToGive).Reverse ().ToArray (); ;
                 }
                 }
 
 
                 break;
                 break;
@@ -137,6 +140,8 @@ public class Aligner : INotifyPropertyChanged
                     case AlignmentModes.EndToStart:
                     case AlignmentModes.EndToStart:
                         return Start (in sizesCopy, maxSpaceBetweenItems, spacesToGive).Reverse ().ToArray ();
                         return Start (in sizesCopy, maxSpaceBetweenItems, spacesToGive).Reverse ().ToArray ();
 
 
+                    case AlignmentModes.EndToStart | AlignmentModes.IgnoreFirstOrLast:
+                        return IgnoreLast (in sizesCopy, containerSize, totalItemsSize, maxSpaceBetweenItems, spacesToGive).Reverse ().ToArray (); ;
                 }
                 }
 
 
                 break;
                 break;

+ 1 - 5
Terminal.Gui/View/Layout/Dim.cs

@@ -150,11 +150,7 @@ public abstract class Dim
     /// <summary>Creates a percentage <see cref="Dim"/> object that is a percentage of the width or height of the SuperView.</summary>
     /// <summary>Creates a percentage <see cref="Dim"/> object that is a percentage of the width or height of the SuperView.</summary>
     /// <returns>The percent <see cref="Dim"/> object.</returns>
     /// <returns>The percent <see cref="Dim"/> object.</returns>
     /// <param name="percent">A value between 0 and 100 representing the percentage.</param>
     /// <param name="percent">A value between 0 and 100 representing the percentage.</param>
-    /// <param name="usePosition">
-    ///     If <see langword="true"/> the dimension is computed using the View's position (<see cref="View.X"/> or
-    ///     <see cref="View.Y"/>).
-    ///     If <see langword="false"/> the dimension is computed using the View's <see cref="View.ContentSize"/>.
-    /// </param>
+    /// <param name="mode">the mode. Defaults to <see cref="DimPercentMode.ContentSize"/>.</param>
     /// <example>
     /// <example>
     ///     This initializes a <see cref="TextField"/> that will be centered horizontally, is 50% of the way down, is 30% the
     ///     This initializes a <see cref="TextField"/> that will be centered horizontally, is 50% of the way down, is 30% the
     ///     height,
     ///     height,

+ 5 - 5
Terminal.Gui/View/Layout/PosAlign.cs

@@ -73,11 +73,11 @@ public class PosAlign : Pos
                                                v =>
                                                v =>
                                                {
                                                {
                                                    return dimension switch
                                                    return dimension switch
-                                                          {
-                                                              Dimension.Width when v.X is PosAlign alignX => alignX.GroupId == groupId,
-                                                              Dimension.Height when v.Y is PosAlign alignY => alignY.GroupId == groupId,
-                                                              _ => false
-                                                          };
+                                                   {
+                                                       Dimension.Width when v.X is PosAlign alignX => alignX.GroupId == groupId,
+                                                       Dimension.Height when v.Y is PosAlign alignY => alignY.GroupId == groupId,
+                                                       _ => false
+                                                   };
                                                })
                                                })
                                        .ToList ();
                                        .ToList ();