[pitivi] timeline/timeline.py: fix implementation of _overlapsAreTransitions()



commit 1406ebb700527d7059dc7c8f6559e1ea53cfc5ae
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date:   Mon Mar 8 17:25:41 2010 -0800

    timeline/timeline.py: fix implementation of _overlapsAreTransitions()

 pitivi/timeline/timeline.py |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 55bb1bf..107125c 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1173,7 +1173,7 @@ class MoveContext(EditingContext):
             right_obj = right_gap.right_object
             right_end = right_obj.start + right_obj.duration
 
-            if right_end < focus.start + self.focus.duration:
+            if right_end < focus_end:
                 return False
 
             # check that the next next object starts after we end
@@ -1199,8 +1199,18 @@ class MoveContext(EditingContext):
         final_priority = self.focus.priority
         final_position = self.focus.start
 
-        # adjust priority
         priority = final_priority
+
+        # special case for transitions. Allow a single object to overlap
+        # either of its two neighbors if it overlaps no other objects
+        if len(self.timeline_objects) == 1:
+            if not self._overlapsAreTransitions(focus_timeline_object,
+                priority):
+                self._defaultTo (initial_position, initial_priority)
+            EditingContext.finish(self)
+            return
+
+        # adjust priority
         overlap = False
         while True:
             left_gap, right_gap = self._getGapsAtPriority(priority)
@@ -1227,9 +1237,9 @@ class MoveContext(EditingContext):
             return
 
         self._defaultTo(initial_position, priority)
+        delta = final_position - initial_position
         left_gap, right_gap = self._getGapsAtPriority(priority)
 
-        delta = final_position - initial_position
         if delta > 0 and right_gap.duration < delta:
             final_position = initial_position + right_gap.duration
         elif delta < 0 and left_gap.duration < abs(delta):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]