[pitivi] Adjust drag'n'drop position calculation for separators



commit b47ff0c865bf4b056f54b6366bf88bbc9f667049
Author: Paul Lange <palango gmx de>
Date:   Sun Jul 15 21:51:20 2012 +0200

    Adjust drag'n'drop position calculation for separators

 pitivi/timeline/timeline.py |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 40bc058..64dcf70 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -783,16 +783,26 @@ class TimelineControls(gtk.VBox, Loggable):
         """
         counter = 0
         index = 0
+        last = None
 
-        # find new position
+        # find new index
         for child in self.get_children():
-            next = counter + child.getHeight()
+            next = counter + child.getControlHeight()
+
+            # add height of last separator
+            if last:
+                next += last.getSeparatorHeight()
+
+            # check if current interval matches y
             if y >= counter and y < next:
                 return self._limitPositionIndex(index, widget)
 
+            # setup next iteration
             counter = next
             index += 1
+            last = child
 
+        # return a limited index
         return self._limitPositionIndex(index, widget)
 
     def _limitPositionIndex(self, index, widget):



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