Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
GestureConfigLongPress.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 
5 namespace SiliconStudio.Paradox.Input
6 {
7  /// <summary>
8  /// Configuration class the Long Press gestures.
9  /// </summary>
10  /// <remarks>A longPress gesture can be composed of 1 or more fingers.</remarks>
11  public sealed class GestureConfigLongPress : GestureConfig
12  {
13  /// <summary>
14  /// The value represents the maximum distance a finger can translate during the longPress action.
15  /// </summary>
16  /// <exception cref="ArgumentOutOfRangeException">The value has to be positive.</exception>
17  /// <exception cref="InvalidOperationException">Tried to modify the configuration after it has been frozen by the system.</exception>
18  /// <remarks>
19  /// By increasing this value, the user allows small movements of the fingers during the long press.
20  /// By decreasing this value, the user forbids any movements during the long press.</remarks>
21  public float MaximumTranslationDistance
22  {
23  get { return maximumTransDst; }
24  set
25  {
26  CheckNotFrozen();
27 
28  if (value < 0)
29  throw new ArgumentOutOfRangeException("value");
30 
31  maximumTransDst = value;
32  }
33  }
34  private float maximumTransDst;
35 
36  /// <summary>
37  /// The time the user has to hold his finger on the screen to trigger the gesture.
38  /// </summary>
39  /// <exception cref="InvalidOperationException">Tried to modify the configuration after it has been frozen by the system.</exception>
40  public TimeSpan RequiredPressTime
41  {
42  get { return requiredPressTime; }
43  set
44  {
45  CheckNotFrozen();
46 
47  requiredPressTime = value;
48  }
49  }
50  private TimeSpan requiredPressTime;
51 
52  /// <summary>
53  /// Create a default LongPress gesture configuration.
54  /// </summary>
55  /// <remarks>Single finger and 1 second long press.</remarks>
57  {
58  AssociatedGestureType = GestureType.LongPress;
59 
60  RequiredNumberOfFingers = 1;
61  RequiredPressTime = TimeSpan.FromSeconds(0.75);
62  MaximumTranslationDistance = 0.02f;
63  }
64 
65  internal override GestureRecognizer CreateRecognizerImpl(float screenRatio)
66  {
67  return new GestureRecognizerLongPress(this, screenRatio);
68  }
69  }
70 }
Configuration class the Long Press gestures.
This represents the base class for all gesture configuration.
GestureConfigLongPress()
Create a default LongPress gesture configuration.