Example #1
0
        public virtual void PinchStretch(
            PointI startPoint,
            uint initialDistance,
            uint finalDistance,
            uint duration)
        {
            var num1 = (int)ActionHandler.Invoke(sender: this, actionInfo: ActionEventArgs.GetDefault(action: "WaitForReady"));
            var num2 = (int)ActionHandler.Invoke(sender: this, actionInfo: ActionEventArgs.GetDefault(action: "MakeVisible"));

            if (ActionHandler.Invoke(sender: this, actionInfo: new ActionEventArgs(action: nameof(PinchStretch), startPoint, (object)initialDistance, (object)finalDistance, (object)duration)) != ActionResult.Unhandled)
            {
                return;
            }
            var screenPoint = ObjectPointToScreenPoint(objectPoint: startPoint);

            if (initialDistance > finalDistance)
            {
                MultiPointGesture.Current.Move(point: MultiPointGesture.OffsetPinchPoints(targetPoint: screenPoint, boundingRectangle: BoundingRectangle, distance: initialDistance, direction: MultiPointGesture.DefaultPinchStretchDirection));
                MultiPointGesture.Pinch(direction: MultiPointGesture.DefaultPinchStretchDirection, duration: duration, startDistance: initialDistance, endDistance: finalDistance);
            }
            else
            {
                MultiPointGesture.Current.Move(point: screenPoint);
                MultiPointGesture.Stretch(direction: MultiPointGesture.DefaultPinchStretchDirection, duration: duration, startDistance: initialDistance, endDistance: finalDistance);
            }
        }
        public static CompositeInputControllerMartyr Activate(
            PointerInputType inputType)
        {
            var controllerMartyr = new CompositeInputControllerMartyr(previousInputType: ActiveInputType);

            switch (inputType)
            {
            case PointerInputType.Mouse:
                controllerMartyr.Add(martyr: PointerInput.Activate(pointer: Mouse.Instance));
                controllerMartyr.Add(martyr: MouseWheelInput.Activate(mouseWheel: Mouse.Instance));
                break;

            case PointerInputType.Pen:
                controllerMartyr.Add(martyr: PointerInput.Activate(pointer: Pen.Instance));
                controllerMartyr.Add(martyr: SinglePointGesture.Activate(pointer: Pen.Instance));
                break;

            case PointerInputType.SingleTouch:
                controllerMartyr.Add(martyr: PointerInput.Activate(pointer: SingleTouch.Instance));
                controllerMartyr.Add(martyr: SinglePointGesture.Activate(pointer: SingleTouch.Instance));
                break;

            case PointerInputType.MultiTouch:
                controllerMartyr.Add(martyr: PointerInput.Activate(pointer: MultiTouch.Instance));
                controllerMartyr.Add(martyr: SinglePointGesture.Activate(pointer: MultiTouch.Instance));
                controllerMartyr.Add(martyr: MultiPointGesture.Activate(pointer: MultiTouch.Instance));
                break;
            }

            ActiveInputType = inputType;
            return(controllerMartyr);
        }