예제 #1
0
        private IEnumerator Hold()
        {
            yield return(new WaitForSeconds(Delay));

            if (isHold)
            {
                LongPress?.Invoke();
            }
        }
예제 #2
0
        private IEnumerator ContinuousHold()
        {
            yield return(new WaitForSeconds(Delay));

            while (isHold)
            {
                yield return(null);

                LongPress?.Invoke();
            }
        }
예제 #3
0
        private async void OnPreviewPress(object sender, RoutedEventArgs e)
        {
            if (!IsEnabled)
            {
                return;
            }

            if (firstMouseDownHash == -1)
            {
                firstMouseDownHash = GetHashCode();
                IsPressedInternal  = true;

                if (e is MouseButtonEventArgs)
                {
                    PreviewMouseLeftButtonDown?.Invoke(sender, e as MouseButtonEventArgs);
                }
                else if (e is TouchEventArgs)
                {
                    PreviewTouchDown?.Invoke(sender, e as TouchEventArgs);
                }

                PressHold?.Invoke(this, new PressHoldEventArgs(PressHoldEventArgs.EventType.Press));
                if (LongPressEnabled)
                {
                    var longPressMSec      = LongPressDelay.TotalMilliseconds;
                    var longPressStep      = 10;
                    var longPressStepDelay = longPressMSec / longPressStep;

                    while (longPressMSec > 0)
                    {
                        if (firstMouseDownHash == -1)
                        {
                            break;
                        }
                        await Task.Delay(TimeSpan.FromMilliseconds(longPressStepDelay));

                        longPressMSec -= longPressStepDelay;
                    }

                    if (firstMouseDownHash == GetHashCode())
                    {
                        ReleaseAllTouchCaptures();
                        ReleaseMouseCapture();

                        firstMouseDownHash = -1;
                        LongPress?.Invoke(this, e);
                        IsPressedInternal = false;
                        e.Handled         = true;
                    }
                }
            }
        }
예제 #4
0
 /// <summary>
 /// Raises the <see cref="LongPress"/> event.
 /// </summary>
 /// <param name="touchID">The unique identifier of the touch input.</param>
 /// <param name="fingerID">The unique identifier of the finger which caused the touch.</param>
 /// <param name="x">The normalized x-coordinate of the touch.</param>
 /// <param name="y">The normalized y-coordinate of the touch.</param>
 /// <param name="pressure">The normalized pressure of the touch.</param>
 protected virtual void OnLongPress(Int64 touchID, Int64 fingerID, Single x, Single y, Single pressure)
 {
     LongPress?.Invoke(this, touchID, fingerID, x, y, pressure);
 }
예제 #5
0
 public void HandleLongPress(object sender, EventArgs e)
 {
     LongPress?.Invoke(this, new EventArgs());
 }
예제 #6
0
 public void OnLongPress(JuniperPointerEventData evt)
 {
     onLongPress?.Invoke(evt);
     LongPress?.Invoke(this, evt);
 }
예제 #7
0
 protected virtual void OnLongPress()
 {
     LongPress?.Invoke(this, EventArgs.Empty);
 }
예제 #8
0
 public virtual void OnLongPress()
 {
     onLongPress?.Invoke();
     LongPress?.Invoke(this, EventArgs.Empty);
 }
예제 #9
0
 public void OnLongPress(object v)
 {
     LongPress?.Invoke(this, new SelectedItemChangedEventArgs(v));
     LongPressCommand?.Execute(v);
 }