update drag and drop for dragged annotation to be well displayed and avoid DnD problems
authorcavaliet
Wed, 21 Oct 2009 16:28:49 +0200
changeset 166 33c2e634df13
parent 165 e78e40b9d761
child 167 206f07a8d887
update drag and drop for dragged annotation to be well displayed and avoid DnD problems
src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs
src/FingersDance.Views/TimelineAnnotationView.xaml
src/FingersDance.Views/TimelineView.xaml
--- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs	Sun Oct 18 17:42:21 2009 +0200
+++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs	Wed Oct 21 16:28:49 2009 +0200
@@ -40,7 +40,7 @@
         private double totalmilliseconds;
         
         private List<Annotation> AnnotList = new List<Annotation>();
-        private float AnnotWidth = 300 + 15; // The surfaceListBox adds 15 pixels between each item
+        private float AnnotWidth = 850 + 15; // The surfaceListBox adds 15 pixels between each item
         private CuttingViewModel CuttingVM;
         private Boolean AnnotWaiting = false;
         private float AnnotTcBegin;
@@ -132,7 +132,7 @@
             // When scaleX = 1, 1 second = 1 pixel. To calculate the new scale, we take the real width in account.
             Double futurScale = (this.ActualWidth-30) / (totalmilliseconds / 1000);
             //Double futurScale = this.ActualWidth / ((totalmilliseconds<30000) ? (totalmilliseconds/10) : (totalmilliseconds / 1000)); // TEMP FOR SHORT CONTENTS
-            tv.RenderTransform = new ScaleTransform(futurScale,1);
+            tv.listview.RenderTransform = new ScaleTransform(futurScale,1);
             //tv.Width = this.ActualWidth - 30;
             
         }
@@ -379,8 +379,11 @@
             };
 
             // We apply the current scale to the dragged annotation
-            ((TimelineAnnotationView)cursorVisual.Content).RenderTransform = this.RenderTransform;
-
+            ((TimelineAnnotationView)cursorVisual.Content).RenderTransform = new TransformGroup();
+            ((TransformGroup)((TimelineAnnotationView)cursorVisual.Content).RenderTransform).Children.Add(tv.listview.RenderTransform);
+            // We apply a translate translate transform to place correctly the dragged annotation
+            ((TransformGroup)((TimelineAnnotationView)cursorVisual.Content).RenderTransform).Children.Add(new TranslateTransform((AnnotWidth / 2) * (1 - ((ScaleTransform)tv.listview.RenderTransform).ScaleX), 0));
+            
             // Add a handler. This will enable the application to change the visual cues. (NOT USEFUL IN FINGERSDANCE CASE)
             //SurfaceDragDrop.AddTargetChangedHandler(cursorVisual, OnTargetChanged);
 
--- a/src/FingersDance.Views/TimelineAnnotationView.xaml	Sun Oct 18 17:42:21 2009 +0200
+++ b/src/FingersDance.Views/TimelineAnnotationView.xaml	Wed Oct 21 16:28:49 2009 +0200
@@ -8,7 +8,7 @@
 	x:Class="FingersDance.Views.TimelineAnnotationView"
     xmlns:vw="clr-namespace:FingersDance.Views"
 	x:Name="UserControl"
-	d:DesignWidth="640" d:DesignHeight="480" Width="300" Height="40">
+	d:DesignWidth="640" d:DesignHeight="480" Width="850" Height="40">
     <UserControl.Resources>
         <vw:ThicknessSingleValueConverter x:Name="myThicknessSingleValueConverter" x:Key="myThicknessSingleValueConverter"/>
         <vw:VisibilityConverter x:Name="myVisibilityConverter" x:Key="myVisibilityConverter"/>
--- a/src/FingersDance.Views/TimelineView.xaml	Sun Oct 18 17:42:21 2009 +0200
+++ b/src/FingersDance.Views/TimelineView.xaml	Wed Oct 21 16:28:49 2009 +0200
@@ -2,7 +2,8 @@
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:vw="clr-namespace:FingersDance.Views"
-    xmlns:Custom="http://schemas.microsoft.com/surface/2008">
+    xmlns:Custom="http://schemas.microsoft.com/surface/2008"
+    Width="1700" >
     <UserControl.Resources>
         <DataTemplate x:Key="slbDataTemplate">
             <vw:TimelineAnnotationView/>