private IEnumerator Hold() { yield return(new WaitForSeconds(Delay)); if (isHold) { LongPress?.Invoke(); } }
private IEnumerator ContinuousHold() { yield return(new WaitForSeconds(Delay)); while (isHold) { yield return(null); LongPress?.Invoke(); } }
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; } } } }
/// <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); }
public void HandleLongPress(object sender, EventArgs e) { LongPress?.Invoke(this, new EventArgs()); }
public void OnLongPress(JuniperPointerEventData evt) { onLongPress?.Invoke(evt); LongPress?.Invoke(this, evt); }
protected virtual void OnLongPress() { LongPress?.Invoke(this, EventArgs.Empty); }
public virtual void OnLongPress() { onLongPress?.Invoke(); LongPress?.Invoke(this, EventArgs.Empty); }
public void OnLongPress(object v) { LongPress?.Invoke(this, new SelectedItemChangedEventArgs(v)); LongPressCommand?.Execute(v); }