Author: alanmc
Date: 2007-08-24 19:05:15 -0400 (Fri, 24 Aug 2007)
New Revision: 84835

Modified:
   trunk/lunareclipse/ChangeLog
   trunk/lunareclipse/Model/StoryboardManager.cs
Log:
* Model/StoryboardManager.cs: Fixed logic for changing a property which
  hasn't been changed before. It now correctly starts changing after
  the previous keyframe

Modified: trunk/lunareclipse/ChangeLog
===================================================================
--- trunk/lunareclipse/ChangeLog        2007-08-24 22:52:01 UTC (rev 84834)
+++ trunk/lunareclipse/ChangeLog        2007-08-24 23:05:15 UTC (rev 84835)
@@ -1,5 +1,11 @@
 2007-08-24  Alan McGovern <[EMAIL PROTECTED]> 
 
+       * Model/StoryboardManager.cs: Fixed logic for changing a property which
+         hasn't been changed before. It now correctly starts changing after the
+         previous keyframe
+
+2007-08-24  Alan McGovern <[EMAIL PROTECTED]> 
+
        * Model/StoryboardManager.cs: Resetting the shapes to their original 
values
          before replaying the animation
        * Controls/TimeLine/AnimationTimeline.cs: Update for logic behind 
adding a

Modified: trunk/lunareclipse/Model/StoryboardManager.cs
===================================================================
--- trunk/lunareclipse/Model/StoryboardManager.cs       2007-08-24 22:52:01 UTC 
(rev 84834)
+++ trunk/lunareclipse/Model/StoryboardManager.cs       2007-08-24 23:05:15 UTC 
(rev 84835)
@@ -171,6 +171,7 @@
                        DependencyObject target = null;
                        DependencyProperty property = null;
                        LinearDoubleKeyFrame keyframe = null;
+                       LinearDoubleKeyFrame previouskf = null;
 
                        // If the name of something changed, then we need to 
update references to that item
                        // in all our storyboards and update them accordingly
@@ -197,12 +198,14 @@
                        // Get a timeline: either an existing one or a new one
                        DoubleAnimationUsingKeyFrames timeline = 
GetTimeline(target, property);
                        
+                       // Get the time of the keyframe previous to where the 
cursor is on the timeline.
+                       TimeSpan previous = 
controller.Timeline.GetKeyframeBefore(controller.Timeline.CurrentPosition);
+                       
                        // If this is a new timeline, we should add in a 
keyframe at 00:00 recording 
                        // the initial value of the property. This way if the 
'first' keyframe is at
                        // a time other than 0:00, things will move correctly.
                        if(timeline.KeyFrames.Count == 0)
                        {
-                               TimeSpan previous = 
controller.Timeline.GetKeyframeBefore(controller.Timeline.CurrentPosition);
                                LinearDoubleKeyFrame kf = new 
LinearDoubleKeyFrame();
                                kf.KeyTime = previous;
                                kf.Value = Convert.ToDouble(target == e.Target 
? e.OldValue : target.GetValue(property));
@@ -215,6 +218,8 @@
                        foreach(LinearDoubleKeyFrame kf in timeline.KeyFrames)
                                if(kf.KeyTime == 
controller.Timeline.CurrentPosition)
                                        keyframe = kf;
+                               else if(kf.KeyTime == previous)
+                                       previouskf = kf;
                        
                        // Otherwise we just create a new keyframe for this time
                        if(keyframe == null)
@@ -225,6 +230,14 @@
                                timeline.KeyFrames.Add(keyframe);
                                controller.Timeline.AddKeyframe(timeline, 
keyframe.KeyTime.TimeSpan);
                        }
+                       if(previouskf == null)
+                       {
+                               previouskf = new LinearDoubleKeyFrame();
+                               previouskf.Value = Convert.ToDouble(target == 
e.Target ? e.OldValue : target.GetValue(property));
+                               previouskf.KeyTime = previous;
+                               timeline.KeyFrames.Add(previouskf);
+                               controller.Timeline.AddKeyframe(timeline, 
keyframe.KeyTime.TimeSpan);
+                       }
                        
                        double difference = Convert.ToDouble(e.NewValue) - 
Convert.ToDouble(e.OldValue);
                        keyframe.Value = Convert.ToDouble(e.NewValue);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to