Struct that holds the information of a gesture.
 /// <summary>
 /// Initializes a new instance of the <see cref="GestureEventArgs"/> class.
 /// </summary>
 /// <param name="sample">The gesture that was performed.</param>
 public GestureEventArgs(GestureSample sample)
 {
     this.GestureSample = sample;
 }
Beispiel #2
0
 /// <summary>
 /// Invokes the event.
 /// </summary>
 /// <param name="touchEvent">The touch event.</param>
 /// <param name="sample">The gesture sample.</param>
 private void InvokeEvent(EventHandler<GestureEventArgs> touchEvent, GestureSample sample)
 {
     if (touchEvent != null)
     {
         touchEvent(this.Owner, new GestureEventArgs(sample));
     }
 }
Beispiel #3
0
        /// <summary>
        /// Handle the NoneState
        /// </summary>
        private void NoneState()
        {
            if (this.currentTouches.Count > 0)
            {
                TouchLocation touch = this.currentTouches[0];
                this.currentCentroid = touch.Position;

                this.gestureSample = new GestureSample();
                this.gestureSample.IsNew = touch.IsNew;
                this.gestureSample.DeltaScale = 1;
                this.gestureSample.Type = GestureType.Pressed;
                this.gestureSample.Position = this.currentCentroid;

                this.InvokeEvent(this.TouchPressed, this.gestureSample);

                this.startTapPosition = touch.Position;
                this.state = GestureType.Pressed;
            }
        }
Beispiel #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TouchGestures"/> class.
 /// By default, scale is within [0.1, 5], the delta scale is set to 1 and there is no 
 /// supported gesture.
 /// </summary>
 /// <param name="projectCamera">Indicates if the touches will be processed using Cameras</param>
 public TouchGestures(bool projectCamera = true)
     : base("TouchGestures" + instances++)
 {
     this.currentTouches = new List<TouchLocation>();
     this.minScale = 0.1f;
     this.maxScale = 5f;
     this.gestureSample = new GestureSample { DeltaScale = 1 };
     this.enabledGestures = SupportedGesture.None;
     this.projectCamera = projectCamera;
 }
Beispiel #5
0
        /// <summary>
        /// This methods is used to set default values by the default constructor of our classes. 
        /// This is called too when an entity is deserializing. 
        /// </summary>
        protected override void DefaultValues()
        {
            base.DefaultValues();

            this.currentTouches = new List<TouchLocation>();
            this.minScale = 0.1f;
            this.maxScale = 5f;
            this.gestureSample = new GestureSample { DeltaScale = 1 };
            this.enabledGestures = SupportedGesture.None;
            this.ProjectCamera = true;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="GestureEventArgs"/> class.
 /// </summary>
 /// <param name="sample">The gesture that was performed.</param>
 public GestureEventArgs(GestureSample sample)
 {
     this.GestureSample = sample;
 }