[pitivi] elements: Fix detection of clicked keyframes line
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] elements: Fix detection of clicked keyframes line
- Date: Mon, 30 May 2016 18:38:43 +0000 (UTC)
commit 5a3d5455014f02cdc685e6d330eb9c1a44040a90
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Thu May 26 00:04:15 2016 +0200
elements: Fix detection of clicked keyframes line
Differential Revision: https://phabricator.freedesktop.org/D1015
pitivi/timeline/elements.py | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index a5f3935..52c6554 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -283,10 +283,10 @@ class KeyframeCurve(FigureCanvas, Loggable):
self.__timeline.app.action_log.begin("Move keyframe curve segment")
x = event.xdata
offsets = self.__keyframes.get_offsets()
- keyframes = offsets[:,0]
+ keyframes = offsets[:, 0]
right = numpy.searchsorted(keyframes, x)
# Remember the clicked line for drag&drop.
- self.__clicked_line = [offsets[right - 1], offsets[right]]
+ self.__clicked_line = (offsets[right - 1], offsets[right])
self.__ydata_drag_start = max(self.__ylim_min, min(event.ydata, self.__ylim_max))
self.handling_motion = True
@@ -309,7 +309,6 @@ class KeyframeCurve(FigureCanvas, Loggable):
elif self.__clicked_line:
self.__dragged = True
ydata = max(self.__ylim_min, min(event.ydata, self.__ylim_max))
- offsets = self.__keyframes.get_offsets()
delta = ydata - self.__ydata_drag_start
for offset, value in self.__clicked_line:
value = max(self.__ylim_min, min(value + delta, self.__ylim_max))
@@ -342,13 +341,13 @@ class KeyframeCurve(FigureCanvas, Loggable):
if self.__offset is not None:
self.debug("Keyframe released")
self.__timeline.app.action_log.commit("Move keyframe")
- elif self.__clicked_line is not None:
+ elif self.__clicked_line:
self.debug("Line released")
self.__timeline.app.action_log.commit("Move keyframe curve segment")
self.handling_motion = False
self.__offset = None
- self.__clicked_line = None
+ self.__clicked_line = ()
if self.__dragged:
# The keyframe or keyframe line has already been dragged.
@@ -360,7 +359,6 @@ class KeyframeCurve(FigureCanvas, Loggable):
else:
self.__keyframe_removed = False
-
def __setTooltip(self, event):
if event.xdata:
xdata = max(self.__line_xs[0], min(event.xdata, self.__line_xs[-1]))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]