[pitivi] timeline: Simplify the layer dragging logic



commit 01f1e2e7f3c896e0bbec4d9f83598a8f33441305
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Fri Oct 2 14:42:01 2015 +0200

    timeline: Simplify the layer dragging logic
    
    Summary:
    The simplification is done by ignoring the separators when dragging a
    layer. Dragging on separators means "create a new layer" and we never
    create a new layer when we move a layer.
    
    Reviewers: thiblahute
    
    Projects: #pitivi
    
    Reviewed By: thiblahute
    
    Differential Revision: https://phabricator.freedesktop.org/D290

 pitivi/timeline/timeline.py |   14 +++-----------
 1 files changed, 3 insertions(+), 11 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 581b037..69856de 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -617,18 +617,10 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
         elif self.__moving_layer:
             event_widget = self.get_event_widget(event)
             unused_x, y = event_widget.translate_coordinates(self, event.x, event.y)
-            priority = self.__moving_layer.get_priority()
-            layer, on_sep = self.__getLayerAt(y)
-
-            if on_sep:
-                if layer.ui.after_sep in on_sep:
-                    priority = layer.get_priority() + 1
-                else:
-                    priority = layer.get_priority() - 1
-            elif layer != self.__moving_layer:
+            layer, unused_on_sep = self.__getLayerAt(y, prefer_bLayer=self.__moving_layer)
+            if layer != self.__moving_layer:
                 priority = layer.get_priority()
-
-            self.moveLayer(self.__moving_layer, priority)
+                self.moveLayer(self.__moving_layer, priority)
         elif self.__marquee.start_x:
             self.__marquee.move(event)
 


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