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); }
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); }