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

elements: Keyframes no longer merge when dragged close to each other

When dragging keyframes close to each other, they sometimes merged. This
happened because we were inserting elements with the same timestamp in
the dictionary holding keyframes.

Fixes T7716
Reviewed-by: Alexandru Băluț's avatarAlex Băluț <alexandru.balut@gmail.com>
Differential Revision: https://phabricator.freedesktop.org/D1683
parent 16927e16
......@@ -393,12 +393,12 @@ class KeyframeCurve(FigureCanvas, Loggable):
return event.xdata
i = values.index(kf)
if event.xdata > self.__offset:
if values[i + 1].timestamp < event.xdata:
return max(0, values[i + 1].timestamp - 1)
else:
if i > 1 and values[i - 1].timestamp > event.xdata:
return values[i - 1].timestamp + 1
keyframe_timestamp = int(event.xdata)
if keyframe_timestamp <= values[i - 1].timestamp:
keyframe_timestamp = values[i - 1].timestamp + 1
if keyframe_timestamp >= values[i + 1].timestamp:
keyframe_timestamp = values[i + 1].timestamp - 1
return keyframe_timestamp
return event.xdata
......
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