예제 #1
0
        void InitialFixLine()
        {
            ModelElement m = new ModelElement();

            m.Load(LineMod.ModData);
            Left = new LayoutLine(this, m, Direction.Vertical, false);

            m = new ModelElement();
            m.Load(LineMod.ModData);
            Right = new LayoutLine(this, m, Direction.Vertical, false);

            m = new ModelElement();
            m.Load(LineMod.ModData);
            Top = new LayoutLine(this, m, Direction.Vertical, false);

            m = new ModelElement();
            m.Load(LineMod.ModData);
            Down = new LayoutLine(this, m, Direction.Vertical, false);

            Vector2 size = model.data.sizeDelta;
            float   rx   = size.x * 0.5f;
            float   ty   = size.y * 0.5f;

            Left.SetSize(new Vector2(-rx, 0), new Vector2(LineWidth, size.y));
            Right.SetSize(new Vector2(rx, 0), new Vector2(LineWidth, size.y));
            Top.SetSize(new Vector2(0, ty), new Vector2(size.x, LineWidth));
            Down.SetSize(new Vector2(0, -ty), new Vector2(size.x, LineWidth));
        }
예제 #2
0
        LayoutLine AddHorizontalLine(float r)
        {
            var m = new ModelElement();

            m.Load(Top.model.ModData);
            float ex = Right.model.data.localPosition.x;
            float sx = Left.model.data.localPosition.x;
            float w  = ex - sx;

            if (w < 0)
            {
                w = -w;
            }
            LayoutLine line = new LayoutLine(layout, m, Direction.Horizontal);
            var        pos  = model.data.localPosition;
            float      dy   = Down.model.data.localPosition.y;

            pos.y  = Top.model.data.localPosition.y - dy;
            pos.y *= r;
            pos.y += dy;
            line.SetSize(pos, new Vector2(w, Layout.LineWidth));
            line.SetLineStart(Left);
            line.SetLineEnd(Right);
            return(line);
        }
예제 #3
0
        LayoutLine AddVerticalLine(float r)
        {
            var m = new ModelElement();

            m.Load(Left.model.ModData);
            float ex = Top.model.data.localPosition.y;
            float sx = Down.model.data.localPosition.y;
            float w  = ex - sx;

            if (w < 0)
            {
                w = -w;
            }
            LayoutLine line = new LayoutLine(layout, m, Direction.Vertical);
            var        pos  = model.data.localPosition;
            float      dx   = Left.model.data.localPosition.x;

            pos.x  = Right.model.data.localPosition.x - dx;
            pos.x *= r;
            pos.x += dx;
            line.SetSize(pos, new Vector2(Layout.LineWidth, w));
            line.SetLineStart(Down);
            line.SetLineEnd(Top);
            return(line);
        }
예제 #4
0
 public void SetTopLine(LayoutLine line)
 {
     if (Top != null)
     {
         Top.Down.Remove(this);
     }
     Top = line;
     line.Down.Add(this);
 }
예제 #5
0
 public void SetDownLine(LayoutLine line)
 {
     if (Down != null)
     {
         Down.Top.Remove(this);
     }
     Down = line;
     line.Top.Add(this);
 }
예제 #6
0
 public void SetLeftLine(LayoutLine line)
 {
     if (Left != null)
     {
         Left.Right.Remove(this);
     }
     Left = line;
     line.Right.Add(this);
 }
예제 #7
0
 public void SetRightLine(LayoutLine line)
 {
     if (Right != null)
     {
         Right.Left.Remove(this);
     }
     Right = line;
     line.Left.Add(this);
 }
예제 #8
0
 public void SetLineEnd(LayoutLine line)
 {
     if (LineEnd != null)
     {
         LineEnd.AdjacentLines.Remove(this);
     }
     LineEnd = line;
     LineEnd.AdjacentLines.Add(this);
 }
예제 #9
0
 public void SetLineStart(LayoutLine line)
 {
     if (LineStart != null)
     {
         LineStart.AdjacentLines.Remove(this);
     }
     LineStart = line;
     LineStart.AdjacentLines.Add(this);
 }
예제 #10
0
 void Release()
 {
     if (LineStart != null)
     {
         LineStart.AdjacentLines.Remove(this);
     }
     if (LineEnd != null)
     {
         LineEnd.AdjacentLines.Remove(this);
     }
     LineStart = null;
     LineEnd   = null;
 }
예제 #11
0
        public void MergeDown(LayoutLine line)
        {
            line.Release();
            Down.AddRange(line.Down);
            var areas = line.Down;

            for (int i = 0; i < areas.Count; i++)
            {
                areas[i].Top = this;
            }
            model.data.localPosition.x = line.model.data.localPosition.x;
            var al = line.AdjacentLines;
            int c  = al.Count - 1;

            for (; c >= 0; c--)
            {
                var l = al[c];
                l.SetLineEnd(this);
            }
        }
예제 #12
0
        public void MergeRight(LayoutLine line)
        {
            line.Release();
            Right.AddRange(line.Right);
            var areas = line.Right;

            for (int i = 0; i < areas.Count; i++)
            {
                areas[i].Left = this;
            }
            model.data.localPosition.y = line.model.data.localPosition.y;
            var al = line.AdjacentLines;
            int c  = al.Count - 1;

            for (; c >= 0; c--)
            {
                var l = al[c];
                l.SetLineStart(this);
            }
        }