示例#1
0
文件: OverBar.cs 项目: Civa/Zenith
 public OverBar(Box box, double kern, double thickness)
     : base()
 {
     Add(new StrutBox(0, thickness, 0, 0));
     Add(new HorizontalRule(thickness, box.Width, 0));
     Add(new StrutBox(0, kern, 0, 0));
     Add(box);
 }
示例#2
0
        public override void Add(Box box)
        {
            base.Add(box);

            childBoxesTotalWidth += box.Width;
            this.Width = Math.Max(this.Width, childBoxesTotalWidth);
            this.Height = Math.Max((this.Children.Count == 0 ? double.NegativeInfinity : Height), box.Height - box.Shift);
            this.Depth = Math.Max((this.Children.Count == 0 ? double.NegativeInfinity : Depth), box.Depth + box.Shift);
        }
示例#3
0
        public override void Add(Box box)
        {
            base.Add(box);

            if (this.Children.Count == 1)
            {
                this.Height = box.Height;
                this.Depth = box.Depth;
            }
            else
            {
                this.Depth += box.Height + box.Depth;
            }
            RecalculateWidth(box);
        }
示例#4
0
        public override void Add(int position, Box box)
        {
            base.Add(position, box);

            if (position == 0)
            {
                this.Depth += box.Depth + Height;
                this.Height = box.Height;
            }
            else
            {
                this.Depth += box.Height + box.Depth;
            }
            RecalculateWidth(box);
        }
示例#5
0
        public OverUnderBox(Box baseBox, Box delimeterBox, Box scriptBox, double kern, bool over)
            : base()
        {
            this.BaseBox = baseBox;
            this.DelimeterBox = delimeterBox;
            this.ScriptBox = scriptBox;
            this.Kern = kern;
            this.Over = over;

            // Calculate dimensions of box.
            this.Width = baseBox.Width;
            this.Height = baseBox.Height + (over ? delimeterBox.Width : 0) +
                (over && scriptBox != null ? scriptBox.Height + scriptBox.Depth + kern : 0);
            this.Depth = baseBox.Depth + (over ? 0 : delimeterBox.Width) +
                (!over && scriptBox == null ? 0 : scriptBox.Height + scriptBox.Depth + kern);
        }
示例#6
0
 public HorizontalBox(Box box, double width, TexAlignment alignment)
     : this()
 {
     var extraWidth = width - box.Width;
     if (alignment == TexAlignment.Center)
     {
         var strutBox = new StrutBox(extraWidth / 2, 0, 0, 0);
         Add(strutBox);
         Add(box);
         Add(strutBox);
     }
     else if (alignment == TexAlignment.Left)
     {
         Add(box);
         Add(new StrutBox(extraWidth, 0, 0, 0));
     }
     else if (alignment == TexAlignment.Right)
     {
         Add(new StrutBox(extraWidth, 0, 0, 0));
         Add(box);
     }
 }
示例#7
0
 public VerticalBox(Box box, double rest, TexAlignment alignment)
     : this()
 {
     Add(box);
     if (alignment == TexAlignment.Center)
     {
         var strutBox = new StrutBox(0, rest / 2, 0, 0);
         base.Add(0, strutBox);
         this.Height += rest / 2;
         this.Depth += rest / 2;
         base.Add(strutBox);
     }
     else if (alignment == TexAlignment.Top)
     {
         this.Depth += rest;
         base.Add(new StrutBox(0, rest, 0, 0));
     }
     else if (alignment == TexAlignment.Bottom)
     {
         this.Height += rest;
         base.Add(0, new StrutBox(0, rest, 0, 0));
     }
 }
示例#8
0
 private void RecalculateWidth(Box box)
 {
     this.leftMostPos = Math.Min(leftMostPos, box.Shift);
     this.rightMostPos = Math.Max(rightMostPos, box.Shift + (box.Width > 0 ? box.Width : 0));
     this.Width = rightMostPos - leftMostPos;
 }
示例#9
0
 public HorizontalBox(Box box)
     : this()
 {
     Add(box);
 }
示例#10
0
文件: Box.cs 项目: spirit11/wpf-math
 public virtual void Add(int position, Box box)
 {
     this.children.Insert(position, box);
 }
示例#11
0
 private static Box ChangeWidth(Box box, double maxWidth)
 {
     if (box != null && Math.Abs(maxWidth - box.Width) > TexUtilities.FloatPrecision)
         return new HorizontalBox(box, maxWidth, TexAlignment.Center);
     else
         return box;
 }
示例#12
0
文件: Box.cs 项目: Civa/Zenith
 public virtual void Add(int position, Box box)
 {
     this.children.Insert(position, box);
 }
示例#13
0
文件: Box.cs 项目: Civa/Zenith
 public virtual void Add(Box box)
 {
     this.children.Add(box);
 }
示例#14
0
 private void RecalculateWidth(Box box)
 {
     this.leftMostPos  = Math.Min(leftMostPos, box.Shift);
     this.rightMostPos = Math.Max(rightMostPos, box.Shift + (box.Width > 0 ? box.Width : 0));
     this.Width        = rightMostPos - leftMostPos;
 }
示例#15
0
 private static Box ChangeWidth(Box box, double maxWidth)
 {
     // Centre specified box in new box of specified width, if necessary.
     if (Math.Abs(maxWidth - box.Width) > TexUtilities.FloatPrecision)
         return new HorizontalBox(box, maxWidth, TexAlignment.Center);
     else
         return box;
 }
示例#16
0
文件: FencedAtom.cs 项目: Civa/Zenith
 private static void CentreBox(Box box, double axis)
 {
     var totalHeight = box.Height + box.Depth;
     box.Shift = -(totalHeight / 2 - box.Height) - axis;
 }
示例#17
0
 internal TexRenderer(Box box, double scale)
 {
     this.Box = box;
     this.Scale = scale;
 }
示例#18
0
文件: Box.cs 项目: spirit11/wpf-math
 public virtual void Add(Box box)
 {
     this.children.Add(box);
 }