Annotation from a recognised gesture corrected.
authorcavaliet
Tue, 17 Nov 2009 13:40:58 +0100
changeset 207 6405d0b7d085
parent 206 89813df17ec2
child 208 0699cab5cbb3
Annotation from a recognised gesture corrected.
src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs
--- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs	Tue Nov 17 13:25:05 2009 +0100
+++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs	Tue Nov 17 13:40:58 2009 +0100
@@ -365,7 +365,10 @@
         {
             GestureRoutedEventArgs grea = (GestureRoutedEventArgs)e;
             Console.WriteLine("Timeline NewGestureRegognized " + grea.Gesture.Name + ", " + grea.Gesture.Start + ", " + grea.Gesture.End);
-            addAnnotation(new AnnotationViewModel(new Annotation("temp",(float)grea.Gesture.Start, (float)(grea.Gesture.End-grea.Gesture.Start + 20), grea.Gesture.Name, CurrentColor), 0));
+            // If the stroke has been drawed very fast, end and start can be the same, so we add a little length.
+            float dur = (float)(grea.Gesture.End - grea.Gesture.Start);
+            if (dur == 0) dur = (float)0.5;
+            addAnnotation(new AnnotationViewModel(new Annotation("temp",(float)grea.Gesture.Start, (float)(grea.Gesture.End-grea.Gesture.Start), grea.Gesture.Name, CurrentColor), 0));
         }
 
         private void listview_PreviewContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)