[pitivi] elements: A keyframe is no longer created when moving a clip
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] elements: A keyframe is no longer created when moving a clip
- Date: Sun, 26 Feb 2017 14:18:29 +0000 (UTC)
commit 5c0b3fbd30ce53c8d9154cd7615e26bc22812a0e
Author: Stefan Popa <stefanpopa2209 gmail com>
Date: Sun Feb 26 15:10:03 2017 +0100
elements: A keyframe is no longer created when moving a clip
When drag&dropping a clip, a keyframe was created if the mouse was
released on an yellow keyframe line. This happened because we were
only checking whether the click ended on the keyframe line and not
that it also started there.
Field self.__keyframe_removed is no longer needed. We were using it
to check if a keyframe was just removed, to make sure that a
double-click on a keyframe doesn't add the keyframe back after
removing it. However, we are now adding a new keyframe only if the
click occurs between 2 keyframes, so the situation described above
can't happen anymore.
Fixes T7705
Differential Revision: https://phabricator.freedesktop.org/D1682
pitivi/timeline/elements.py | 20 ++++++--------------
1 files changed, 6 insertions(+), 14 deletions(-)
---
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index 4e08053..d315526 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -157,9 +157,6 @@ class KeyframeCurve(FigureCanvas, Loggable):
self.__hovered = False
- # Whether a keyframe has just been removed.
- self.__keyframe_removed = False
-
self.connect("motion-notify-event", self.__gtkMotionEventCb)
self.connect("event", self._eventCb)
self.connect("notify::height-request", self.__heightRequestCb)
@@ -268,7 +265,6 @@ class KeyframeCurve(FigureCanvas, Loggable):
return
# A keyframe has been double-clicked, remove it.
self.debug("Removing keyframe at timestamp %lf", offset)
- self.__keyframe_removed = True
with self.__timeline.app.action_log.started("Remove keyframe"):
self.__source.unset(offset)
else:
@@ -344,19 +340,15 @@ class KeyframeCurve(FigureCanvas, Loggable):
self.debug("Line released")
self.__timeline.app.action_log.commit("Move keyframe curve segment")
+ if not self.__dragged:
+ # The keyframe line was clicked, but not dragged
+ assert event.guiEvent.type == Gdk.EventType.BUTTON_RELEASE
+ self.__maybeCreateKeyframe(event)
+
self.handling_motion = False
self.__offset = None
self.__clicked_line = ()
-
- if self.__dragged:
- # The keyframe or keyframe line has already been dragged.
- self.__dragged = False
- else:
- assert event.guiEvent.type == Gdk.EventType.BUTTON_RELEASE
- if not self.__keyframe_removed:
- self.__maybeCreateKeyframe(event)
- else:
- self.__keyframe_removed = False
+ self.__dragged = False
def __update_tooltip(self, event):
"""Sets or clears the tooltip showing info about the hovered line."""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]