예제 #1
0
        void ApplyRotation(EvasMap map, ERect geometry, ref bool changed)
        {
            var rotationX = Element.RotationX;
            var rotationY = Element.RotationY;
            var rotationZ = Element.Rotation;
            var anchorX   = Element.AnchorX;
            var anchorY   = Element.AnchorY;

            // apply rotations
            if (rotationX != 0 || rotationY != 0 || rotationZ != 0)
            {
                map.Rotate3D(rotationX, rotationY, rotationZ, (int)(geometry.X + geometry.Width * anchorX),
                             (int)(geometry.Y + geometry.Height * anchorY), 0);
                // the last argument is focal length, it determine the strength of distortion. We compared it with the Android implementation
                map.Perspective3D(geometry.X + geometry.Width / 2, geometry.Y + geometry.Height / 2, 0, (int)(1.3 * Math.Max(geometry.Height, geometry.Width)));
                // Need to unset clip because perspective 3d rotation is going beyond the container bound
                NativeView.SetClip(null);
                changed = true;
            }
        }