src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs
changeset 166 33c2e634df13
parent 162 0b9f989bcb37
child 167 206f07a8d887
equal deleted inserted replaced
165:e78e40b9d761 166:33c2e634df13
    38         //ENDSAR
    38         //ENDSAR
    39 
    39 
    40         private double totalmilliseconds;
    40         private double totalmilliseconds;
    41         
    41         
    42         private List<Annotation> AnnotList = new List<Annotation>();
    42         private List<Annotation> AnnotList = new List<Annotation>();
    43         private float AnnotWidth = 300 + 15; // The surfaceListBox adds 15 pixels between each item
    43         private float AnnotWidth = 850 + 15; // The surfaceListBox adds 15 pixels between each item
    44         private CuttingViewModel CuttingVM;
    44         private CuttingViewModel CuttingVM;
    45         private Boolean AnnotWaiting = false;
    45         private Boolean AnnotWaiting = false;
    46         private float AnnotTcBegin;
    46         private float AnnotTcBegin;
    47         private Color CurrentColor;
    47         private Color CurrentColor;
    48 
    48 
   130         void UserControlTimeLine_SizeChanged(object sender, SizeChangedEventArgs e)
   130         void UserControlTimeLine_SizeChanged(object sender, SizeChangedEventArgs e)
   131         {
   131         {
   132             // When scaleX = 1, 1 second = 1 pixel. To calculate the new scale, we take the real width in account.
   132             // When scaleX = 1, 1 second = 1 pixel. To calculate the new scale, we take the real width in account.
   133             Double futurScale = (this.ActualWidth-30) / (totalmilliseconds / 1000);
   133             Double futurScale = (this.ActualWidth-30) / (totalmilliseconds / 1000);
   134             //Double futurScale = this.ActualWidth / ((totalmilliseconds<30000) ? (totalmilliseconds/10) : (totalmilliseconds / 1000)); // TEMP FOR SHORT CONTENTS
   134             //Double futurScale = this.ActualWidth / ((totalmilliseconds<30000) ? (totalmilliseconds/10) : (totalmilliseconds / 1000)); // TEMP FOR SHORT CONTENTS
   135             tv.RenderTransform = new ScaleTransform(futurScale,1);
   135             tv.listview.RenderTransform = new ScaleTransform(futurScale,1);
   136             //tv.Width = this.ActualWidth - 30;
   136             //tv.Width = this.ActualWidth - 30;
   137             
   137             
   138         }
   138         }
   139 
   139 
   140         #region Timer
   140         #region Timer
   377                     DataContext = findSource.DataContext
   377                     DataContext = findSource.DataContext
   378                 }
   378                 }
   379             };
   379             };
   380 
   380 
   381             // We apply the current scale to the dragged annotation
   381             // We apply the current scale to the dragged annotation
   382             ((TimelineAnnotationView)cursorVisual.Content).RenderTransform = this.RenderTransform;
   382             ((TimelineAnnotationView)cursorVisual.Content).RenderTransform = new TransformGroup();
   383 
   383             ((TransformGroup)((TimelineAnnotationView)cursorVisual.Content).RenderTransform).Children.Add(tv.listview.RenderTransform);
       
   384             // We apply a translate translate transform to place correctly the dragged annotation
       
   385             ((TransformGroup)((TimelineAnnotationView)cursorVisual.Content).RenderTransform).Children.Add(new TranslateTransform((AnnotWidth / 2) * (1 - ((ScaleTransform)tv.listview.RenderTransform).ScaleX), 0));
       
   386             
   384             // Add a handler. This will enable the application to change the visual cues. (NOT USEFUL IN FINGERSDANCE CASE)
   387             // Add a handler. This will enable the application to change the visual cues. (NOT USEFUL IN FINGERSDANCE CASE)
   385             //SurfaceDragDrop.AddTargetChangedHandler(cursorVisual, OnTargetChanged);
   388             //SurfaceDragDrop.AddTargetChangedHandler(cursorVisual, OnTargetChanged);
   386 
   389 
   387             // Create a list of input devices. Add the contacts that
   390             // Create a list of input devices. Add the contacts that
   388             // are currently captured within the dragged element and
   391             // are currently captured within the dragged element and