[pitivi] timeline: Fix dragging an asset to the ruler
- From: Mathieu Duponchelle <mathieudu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] timeline: Fix dragging an asset to the ruler
- Date: Tue, 18 Mar 2014 23:00:45 +0000 (UTC)
commit 8f5d7a3c2368c9e7fa2e1cc61bab445a5bb77f98
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Sun Mar 9 23:04:33 2014 +0100
timeline: Fix dragging an asset to the ruler
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1061824
pitivi/timeline/elements.py | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index fbbda17..da2470a 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -155,10 +155,10 @@ class Ghostclip(Clutter.Actor):
self.props.width = width
def update(self, priority, y, isControlledByBrother):
- self.priority = priority
- # Only tricky part of the code, can be called by the linked track element.
- if priority < 0:
- return
+ # Priority and y can be negative when dragging an asset to the ruler.
+ # Priority can also be negative when dragging a linked element.
+ self.priority = min(max(0, priority), self.nbrLayers)
+ y = max(0, y)
# Here we make it so the calculation is the same for audio and video.
if self.track_type == GES.TrackType.AUDIO and not isControlledByBrother:
@@ -173,22 +173,22 @@ class Ghostclip(Clutter.Actor):
y -= self.nbrLayers * (EXPANDED_SIZE + SPACING)
# Would that be a new layer at the end or inserted ?
- if priority == self.nbrLayers or y % (EXPANDED_SIZE + SPACING) < SPACING:
+ if self.priority == self.nbrLayers or y % (EXPANDED_SIZE + SPACING) < SPACING:
self.shouldCreateLayer = True
self.set_size(self.props.width, SPACING)
- self.props.y = priority * (EXPANDED_SIZE + SPACING)
+ self.props.y = self.priority * (EXPANDED_SIZE + SPACING)
if self.track_type == GES.TrackType.AUDIO:
self.props.y += self.nbrLayers * (EXPANDED_SIZE + SPACING)
self.props.visible = True
else:
self.shouldCreateLayer = False
# No need to mockup on the same layer
- if self.bElement and priority == self.bElement.get_parent().get_layer().get_priority():
+ if self.bElement and self.priority == self.bElement.get_parent().get_layer().get_priority():
self.props.visible = False
# We would be moving to an existing layer.
- elif priority < self.nbrLayers:
+ elif self.priority < self.nbrLayers:
self.set_size(self.props.width, EXPANDED_SIZE)
- self.props.y = priority * (EXPANDED_SIZE + SPACING) + SPACING
+ self.props.y = self.priority * (EXPANDED_SIZE + SPACING) + SPACING
if self.track_type == GES.TrackType.AUDIO:
self.props.y += self.nbrLayers * (EXPANDED_SIZE + SPACING)
self.props.visible = True
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]