Open Thor181 opened 4 months ago
Your current solution yields the following result for a simple matrix \matrix{x & y \\ z & y}:
\matrix{x & y \\ z & y}
As you can see, y is lifted.
y
I would prefer something like this: (with better following the vertical free space, though)
This view has been achieved using the following patch (apply on top of your current changes):
Index: src/XamlMath.Shared/Atoms/MatrixAtom.cs IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/src/XamlMath.Shared/Atoms/MatrixAtom.cs b/src/XamlMath.Shared/Atoms/MatrixAtom.cs --- a/src/XamlMath.Shared/Atoms/MatrixAtom.cs (revision Staged) +++ b/src/XamlMath.Shared/Atoms/MatrixAtom.cs (date 1710274735726) @@ -56,33 +56,25 @@ foreach (var row in cells) { var rowContainer = new HorizontalBox(); - var rowHeight = row.Length > 0 ? row.Max(cell => cell.TotalHeight) : 0.0; + var rowHeight = row.Length > 0 ? row.Max(cell => cell.Height) : 0.0; for (var j = 0; j < columnCount; ++j) { var cell = row[j]; var columnWidth = columnWidths[j]; - var vFreeSpace = rowHeight - cell.TotalHeight; + var vFreeSpace = rowHeight - cell.Height; var tbGap = (VerticalPadding + vFreeSpace) / 2; var cellContainer = new VerticalBox(); + var depth = cell.Depth; - if (cell.TotalHeight <= 0.54) - { - cellContainer.Add(new StrutBox(0.0, vFreeSpace, 0.0, 0.0)); - cellContainer.Add(cell); - cellContainer.Add(new StrutBox(0.0, VerticalPadding / 2, 0.0, 0.0)); - } - else - { - cellContainer.Add(new StrutBox(0.0, tbGap, 0.0, 0.0)); - cellContainer.Add(cell); - cellContainer.Add(new StrutBox(0.0, tbGap, 0.0, 0.0)); - } + cellContainer.Add(new StrutBox(0.0, tbGap, 0.0, 0.0)); + cellContainer.Add(cell); + cellContainer.Add(new StrutBox(0.0, tbGap - depth, 0.0, 0.0)); - cellContainer.Height = cellContainer.TotalHeight; - cellContainer.Depth = 0; + cellContainer.Height = cell.Height; + cellContainer.Depth = cell.Depth; var hFreeSpace = columnWidth - cell.TotalWidth; var (lGap, rGap) = GetLeftRightGap(hFreeSpace, j);
Could you please investigate this patch and try applying it?
Your current solution yields the following result for a simple matrix![image](https://github.com/ForNeVeR/xaml-math/assets/92793/0df6e2c4-008c-4519-920e-0ec2b0a3caa8)
\matrix{x & y \\ z & y}
:As you can see,
y
is lifted.I would prefer something like this:
(with better following the vertical free space, though)
This view has been achieved using the following patch (apply on top of your current changes):
Could you please investigate this patch and try applying it?