Пример #1
0
        public GeometryOld WithoutAnchor(GeometryOld baseGeometry)
        {
            double _x;
            double _y;

            if (Anchor == Anchor.Undefined ||
                Anchor.HasFlag(Anchor.Left))
            {
                _x = X;
            }
            else if (Anchor.HasFlag(Anchor.Right))
            {
                _x = baseGeometry.Width - Width + X;
            }
            else
            {
                _x = (baseGeometry.Width - Width) / 2d + X;
            }

            if (Anchor == Anchor.Undefined ||
                Anchor.HasFlag(Anchor.Top))
            {
                _y = Y;
            }
            else if (Anchor.HasFlag(Anchor.Bottom))
            {
                _y = baseGeometry.Height - Height + Y;
            }
            else
            {
                _y = (baseGeometry.Height - Height) / 2d + Y;
            }

            return(new GeometryOld(_x, _y, Width, Height, Anchor.Undefined));
        }
Пример #2
0
 public GeometryOld RelativeToPoint(GeometryOld geo)
 {
     return(new GeometryOld(Width, Height)
     {
         X = X - geo.X,
         Y = Y - geo.Y
     });
 }
Пример #3
0
 public void UpdateRelativeToPoint(GeometryOld geo)
 {
     X = X - geo.X;
     Y = Y - geo.Y;
 }