Пример #1
0
        private void UpdateAnchors()
        {
            Rectangle parentArea;
            var       viewport = device.Viewport;

            if (Parent != null)
            {
                parentArea = Parent.Area;
            }
            else if (RespectSafeArea)
            {
                parentArea = viewport.TitleSafeArea;
            }
            else
            {
                parentArea = new Rectangle(0, 0, viewport.Width, viewport.Height);
            }

            ControlArea area = new ControlArea(0, 0, (int)size.X, (int)size.Y);

            foreach (var side in anchors)
            {
                if (anchoredPoints.Selected(side.Key))
                {
                    side.Value.Apply(ref area, parentArea, anchoredPoints);
                }
            }

            Area = area.ToRectangle();
        }
Пример #2
0
        public void Apply(ref ControlArea area, Rectangle parentArea, Points anchoredPoints)
        {
            if (AnchorControl != null)
                parentArea = AnchorControl.Area;

            Vector2 pointOnSelf = FindPosition(area.ToRectangle(), Start);
            Vector2 pointOnParent = FindPosition(parentArea, End);

            TranslateArea(ref area, pointOnParent - pointOnSelf + Offset, anchoredPoints);
        }
Пример #3
0
        public void Apply(ref ControlArea area, Rectangle parentArea, Points anchoredPoints)
        {
            if (AnchorControl != null)
            {
                parentArea = AnchorControl.Area;
            }

            Vector2 pointOnSelf   = FindPosition(area.ToRectangle(), Start);
            Vector2 pointOnParent = FindPosition(parentArea, End);

            TranslateArea(ref area, pointOnParent - pointOnSelf + Offset, anchoredPoints);
        }
Пример #4
0
        private void UpdateAnchors()
        {
            Rectangle parentArea;
            var viewport = device.Viewport;
            if (Parent != null)
                parentArea = Parent.Area;
            else if (RespectSafeArea)
                parentArea = viewport.TitleSafeArea;
            else
                parentArea = new Rectangle(0, 0, viewport.Width, viewport.Height);

            ControlArea area = new ControlArea(0, 0, (int)size.X, (int)size.Y);
            foreach (var side in anchors)
            {
                if (anchoredPoints.Selected(side.Key))
                    side.Value.Apply(ref area, parentArea, anchoredPoints);
            }

            Area = area.ToRectangle();
        }