Skip to content

Commit

Permalink
(#349) StrokeBox, LayeredBox: mark as internal
Browse files Browse the repository at this point in the history
  • Loading branch information
ForNeVeR committed May 24, 2023
1 parent 7b54ea7 commit bc7261d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 35 deletions.
65 changes: 32 additions & 33 deletions src/XamlMath.Shared/Boxes/LayeredBox.cs
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;
}
}
4 changes: 2 additions & 2 deletions src/XamlMath.Shared/Boxes/StrokeBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace XamlMath.Boxes;

public class StrokeBox : Box
internal class StrokeBox : Box
{
private readonly StrokeBoxMode _mode;

Expand All @@ -28,7 +28,7 @@ public override int GetLastFontId()
}

[Flags]
public enum StrokeBoxMode
internal enum StrokeBoxMode
{
None = 0,
Normal = 1,
Expand Down

0 comments on commit bc7261d

Please sign in to comment.