瀏覽代碼

more Alignment->Justification

Tig 1 年之前
父節點
當前提交
7bf2bf4785
共有 2 個文件被更改,包括 16 次插入4 次删除
  1. 3 3
      Terminal.Gui/View/ViewText.cs
  2. 13 1
      docfx/docs/migratingfromv1.md

+ 3 - 3
Terminal.Gui/View/ViewText.cs

@@ -34,7 +34,7 @@ public partial class View
     ///     </para>
     ///     <para>
     ///         The text will be drawn starting at the view origin (0, 0) and will be formatted according
-    ///         to <see cref="Justification"/> and <see cref="TextDirection"/>.
+    ///         to <see cref="TextJustification"/> and <see cref="TextDirection"/>.
     ///     </para>
     ///     <para>
     ///         The text will word-wrap to additional lines if it does not fit horizontally. If <see cref="ContentSize"/>'s height
@@ -87,7 +87,7 @@ public partial class View
     ///     <para> <see cref="View.Width"/> or <see cref="View.Height"/> are using <see cref="Dim.DimAutoStyle.Text"/>, the <see cref="ContentSize"/> will be adjusted to fit the text.</para>
     /// </remarks>
     /// <value>The text justification.</value>
-    public virtual Justification Justification
+    public virtual Justification TextJustification
     {
         get => TextFormatter.Justification;
         set
@@ -130,7 +130,7 @@ public partial class View
     ///     <para> <see cref="View.Width"/> or <see cref="View.Height"/> are using <see cref="Dim.DimAutoStyle.Text"/>, the <see cref="ContentSize"/> will be adjusted to fit the text.</para>
     /// </remarks>
     /// <value>The vertical text justification.</value>
-    public virtual Justification VerticalJustification
+    public virtual Justification VerticalTextJustification
     {
         get => TextFormatter.VerticalJustification;
         set

+ 13 - 1
docfx/docs/migratingfromv1.md

@@ -231,4 +231,16 @@ Replace references to to nested types with the new standalone version
 ```diff
 - var myTab = new TabView.Tab();
 + var myTab = new Tab();
-```
+```
+
+## View and Text Alignment is now Justification
+
+In v1, both `TextAlignment` and `VerticalTextAlignment` enums were used to align text in views. In v2, these enums have been replaced with the `Justification` enum. The `View.TextJustification` property controls horizontal text alignment, and the `View.VerticalTextAlignment` property controls vertical text alignment.
+
+v2 now supports `Pos.Justify` which enables views to be justified within their superview. 
+
+### How to Fix
+
+* Replace `TextAlignment` with `Justification` 
+* Replace `VerticalTextAlignment` with `Justification`. `Middle` is now `Center`. 
+* Update any code that used `View.TextAlignment` or `View.VerticalTextAlignment` to justify text in views.