Пример #1
0
        public void TouchGetPointCount()
        {
            tlog.Debug(tag, $"TouchGetPointCount START");
            Touch a1 = new Touch();

            a1.GetPointCount();

            a1.Dispose();

            tlog.Debug(tag, $"TouchGetPointCount END (OK)");
            Assert.Pass("TouchGetPointCount");
        }
Пример #2
0
    private bool OnControlTouch(object target, View.TouchEventArgs args)
    {
        View  view  = target as View;
        Touch touch = args.Touch;

        if (view == null || touch.GetPointCount() != 2)
        {
            return(false);
        }

        Vector2 p1 = touch.GetScreenPosition(0);
        Vector2 p2 = touch.GetScreenPosition(1);

        float radian   = (float)Math.Atan2(p1.Y - p2.Y, p1.X - p2.X);
        float distance = (p1 - p2).Length();

        if (!(touch.GetState(0) == PointStateType.Started || touch.GetState(1) == PointStateType.Started))
        {
            Radian r = new Radian(radian - mLastRadian);
            view.RotateBy(r, new Vector3(0, 0, 1));

            float s = distance / mLastDistance;
            view.ScaleBy(new Vector3(s, s, 1));

            mCurrentAbsRadian += (radian - mLastRadian);

            view.BoxShadow = new Shadow
            {
                Offset     = GetShadowOffsetByCurrentAngle(),
                BlurRadius = DefaultShadowBlurRadius,
            };
        }

        mLastRadian   = radian;
        mLastDistance = distance;

        return(true);
    }