-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iss-1881: Better handling for moving frames beyond the track cell area #1882
iss-1881: Better handling for moving frames beyond the track cell area #1882
Conversation
Rather than putting them back to where they were
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok so this fix seems to work just as described (except that it also affects frames being moved on top of other frames, but I assume that’s intended), however I’m a little confused why it requires so much work. To me it seems like the simplified diff below would essentially have the same effect, yet you must have had a reason to go with the more involved approach. Do you still remember what it is that necessitates the extra work?
diff --git a/core_lib/src/structure/layer.cpp b/core_lib/src/structure/layer.cpp
index c05ca919..09ad6bde 100644
--- a/core_lib/src/structure/layer.cpp
+++ b/core_lib/src/structure/layer.cpp
@@ -640,10 +640,11 @@ bool Layer::moveSelectedFrames(int offset)
step = 1;
// Check if we are not moving out of the timeline
- if (mSelectedFrames_byPosition[0] + offset < 1) return false;
+ if (mSelectedFrames_byPosition[0] + offset < 1) offset = 1 - mSelectedFrames_byPosition[0];
}
- if (!canMoveSelectedFramesToOffset(offset)) { return false; }
+ while (!canMoveSelectedFramesToOffset(offset)) { offset += 1; }
+ if (offset == 0) { return false; }
for (; indexInSelection > -1 && indexInSelection < mSelectedFrames_byPosition.count(); indexInSelection += step)
{
Thanks for reviewing Jakob. If there was a reason for making it so elaborated, I cannot remember it anymore. Your suggested diff does indeed work. I don't see a reason to complicate the logic further if we can avoid it. I'll revert my changes and apply yours instead. |
…881-dragging-beyond-layer-name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, alright then! Thanks for double checking.
* iss-1881: Move frames as far as possible Rather than putting them back to where they were * Exchange implementation for a simpler one * Remove stray parameter doc --------- Co-authored-by: Jakob Gahde <[email protected]>
This fixes #1881
Instead of moving keyframes back to where they were, the frames will now be shifted to the right until there's room for all selected frames.