Commit 5c0b3fbd authored by Stefan Popa's avatar Stefan Popa Committed by Alexandru Băluț

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
parent 01f1f4fb
......@@ -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."""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment