-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#349) StrokeBox, LayeredBox: mark as internal
- Loading branch information
Showing
2 changed files
with
34 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,47 @@ | ||
using System; | ||
using XamlMath.Rendering; | ||
|
||
namespace XamlMath.Boxes | ||
namespace XamlMath.Boxes; | ||
|
||
internal class LayeredBox : Box | ||
{ | ||
public class LayeredBox : Box | ||
public override void Add(Box box) | ||
{ | ||
public override void Add(Box box) | ||
{ | ||
base.Add(box); | ||
base.Add(box); | ||
|
||
if (Children.Count is 1) | ||
{ | ||
Width = box.Width; | ||
Height = box.Height - box.Shift; | ||
Depth = box.Depth + box.Shift; | ||
Italic = box.Italic; | ||
} | ||
else | ||
{ | ||
Width = Math.Max(Width, box.Width); | ||
Height = Math.Max(Height, box.Height - box.Shift); | ||
Depth = Math.Max(Depth, box.Depth + box.Shift); | ||
Italic = Math.Max(Italic, box.Italic); | ||
} | ||
if (Children.Count is 1) | ||
{ | ||
Width = box.Width; | ||
Height = box.Height - box.Shift; | ||
Depth = box.Depth + box.Shift; | ||
Italic = box.Italic; | ||
} | ||
else | ||
{ | ||
Width = Math.Max(Width, box.Width); | ||
Height = Math.Max(Height, box.Height - box.Shift); | ||
Depth = Math.Max(Depth, box.Depth + box.Shift); | ||
Italic = Math.Max(Italic, box.Italic); | ||
} | ||
} | ||
|
||
public override void RenderTo(IElementRenderer renderer, double x, double y) | ||
public override void RenderTo(IElementRenderer renderer, double x, double y) | ||
{ | ||
foreach (var box in Children) | ||
{ | ||
foreach (var box in Children) | ||
{ | ||
renderer.RenderElement(box, x, y + box.Shift); | ||
} | ||
renderer.RenderElement(box, x, y + box.Shift); | ||
} | ||
} | ||
|
||
public override int GetLastFontId() | ||
public override int GetLastFontId() | ||
{ | ||
var fontId = TexFontUtilities.NoFontId; | ||
foreach (var child in Children) | ||
{ | ||
var fontId = TexFontUtilities.NoFontId; | ||
foreach (var child in Children) | ||
{ | ||
fontId = child.GetLastFontId(); | ||
if (fontId == TexFontUtilities.NoFontId) | ||
break; | ||
} | ||
return fontId; | ||
fontId = child.GetLastFontId(); | ||
if (fontId == TexFontUtilities.NoFontId) | ||
break; | ||
} | ||
return fontId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters