Ejemplo n.º 1
0
        public static bool IsDragThresholdReached(this IUIInput input, IUIInput input2)
        {
            var minDragDist = getMiniumDragDistance(input.InputType);

            return
                (input.IsSameSource(input2) && input.IsValidPositionForLisView(true) &&
                 (
                     Math.Abs(input.Position.X - input2.Position.X) > minDragDist.Width ||
                     Math.Abs(input.Position.Y - input2.Position.Y) > minDragDist.Height
                 ));
        }
Ejemplo n.º 2
0
        public static bool IsWithin(this IUIInput input, IUIInput input2, double x, double y)
        {
            return
                (input.IsSameSource(input2) && input.IsValidPositionForLisView(true) &&

                 (
                     Math.Abs(input.Position.X - input2.Position.X) < x &&
                     Math.Abs(input.Position.Y - input2.Position.Y) < y
                 )
                );
        }
Ejemplo n.º 3
0
        public void UpdateInputPressed(IUIInput input)
        {
            if (_dragState == DragState.Released)
            {
                StartInput = InvalidInput.Instance;
                _dragState = DragState.Normal;
            }

            if (!_isDragging && input.IsValidPositionForLisView(true))
            {
                if (input.ClickCount <= 1) //Touch/Stylus input 's ClickCount = 0
                {
                    //When touch and hold it raise a mouse right click command, skip it.
                    if (_dragState == DragState.Touched && input.InputType == UIInputType.MouseRight)
                    {
                        return;
                    }
                    //Console.WriteLine(input);
                    StartInput  = input;
                    _isDragging = false;
                    switch (input.InputType)
                    {
                    case UIInputType.Touch:
                        _startTouchInput = input;
                        _dragState       = DragState.Touched;
                        _touchTime       = DateTime.UtcNow;
                        //input.EventArgs.Handled = true;
                        break;

                    default:
                        switch (_dragState)
                        {
                        case DragState.Touched:
                            break;

                        case DragState.Normal:
                        case DragState.Released:
                            IsDragging = false;
                            _dragState = DragState.Pressed;
                            break;
                        }

                        break;
                    }
                }
            }
            //Console.WriteLine(String.Format("UpdateInputPressed - {0}", _dragState));
        }