Justification->Alignment

This commit is contained in:
Tig
2024-05-10 11:27:02 -06:00
parent c5a6c907a4
commit ce1e243df2
54 changed files with 551 additions and 543 deletions

View File

@@ -66,7 +66,7 @@ The [Pos](~/api/Terminal.Gui.Pos.yml) is the type of `View.X` and `View.Y` and s
* Anchored from the end of the dimension - `Pos.AnchorEnd()`.
* Centered, using `Pos.Center()`.
* The `Pos.Left(otherView)`, `Pos.Top(otherView)`, `Pos.Bottom(otherView)`, `Pos.Right(otherView)` positions of another view.
* Justified (left, right, center, etc...) with other views - `Pos.Justify(Justification)`.
* Aligned (left, right, center, etc...) with other views - `Pos.Justify(Justification)`.
All `Pos` coordinates are relative to the Superview's content area.

View File

@@ -235,12 +235,10 @@ Replace references to to nested types with the new standalone version
## 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.
In v1, both `TextAlignment` and `VerticalTextAlignment` enums were used to align text in views. In v2, these enums have been replaced with the `Alignment` enum. The `View.TextAlignment` 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.
v2 now supports `Pos.Align` 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.
* Replace `VerticalAlignment.Middle` is now `Alignment.Center`.

View File

@@ -27,7 +27,7 @@ The entire library has been reviewed and simplified. As a result, the API is mor
* New! *Built-in Scrolling/Virtual Content Area* - In v1, to have a view a user could scroll required either a bespoke scrolling implementation, inheriting from `ScrollView`, or managing the complexity of `ScrollBarView` directly. In v2, the base-View class supports scrolling inherently. The area of a view visible to the user at a given moment was previously a rectangle called `Bounds`. `Bounds.Location` was always `Point.Empty`. In v2 the visible area is a rectangle called `Viewport` which is a protal into the Views content, which can be bigger (or smaller) than the area visible to the user. Causing a view to scroll is as simple as changing `View.Viewport.Location`. The View's content described by `View.ContentSize`. See [Layout](layout.md) for details.
* New! *`Dim.Auto`* - Automatically sizes the view to fitthe view's Text, SubViews, or ContentArea.
* Improved! *`Pos.AnchorEnd ()`* - New to v2 is `Pos.AnchorEnd ()` (with no parameters) which allows a view to be anchored to the right or bottom of the Superview.
* New! *`Pos.Justify ()`* - Justifies a set of views horizontally or vertically (left, rigth, center, etc...).
* New! *`Pos.Align ()`* - Aligns a set of views horizontally or vertically (left, rigth, center, etc...).
* ...
## New and Improved Built-in Views