예제 #1
0
        public static float GetX(this SKVisualElement childView)
        {
            var x      = childView.X;
            var parent = childView.Parent;

            while (parent != null)
            {
                x     += parent.X;
                parent = parent.Parent;
            }

            return(x);
        }
예제 #2
0
        public static float GetY(this SKVisualElement childView)
        {
            var y      = childView.Y;
            var parent = childView.Parent;

            while (parent != null)
            {
                y     += parent.Y;
                parent = parent.Parent;
            }

            return(y);
        }
예제 #3
0
        public static SKVisualElement ToSKVisualElement(this View element)
        {
            var visualElement = new SKVisualElement((float)element.X, (float)element.Y, (float)element.Width, (float)element.Height, element.Margin);

            switch (element)
            {
            case BoxView boxView:
                visualElement.CornerRadius = boxView.CornerRadius;
                break;

            case Frame frame:
                visualElement.CornerRadius = new CornerRadius(frame.CornerRadius);
                break;
            }

            return(visualElement);
        }