Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Shift-Drag Keyframe fix (#1687)

manongjohn03912c503966
diff --git a/toonz/sources/toonz/cellselection.cpp b/toonz/sources/toonz/cellselection.cpp
index 42a2ee9a5..77f31095d 100644
--- a/toonz/sources/toonz/cellselection.cpp
+++ b/toonz/sources/toonz/cellselection.cpp
@@ -1583,7 +1583,10 @@ void TCellSelection::pasteCells() {
// Retrieves all keyframe positions from mime data and translates them by
// (r0,c0)
std::set<TKeyframeSelection::Position> positions;
- positions.insert(TKeyframeSelection::Position(r0, c0));
+ int newC0 = c0;
+ if (viewer && !viewer->orientation()->isVerticalTimeline())
+ newC0 = c0 - keyframeData->getColumnSpanCount() + 1;
+ positions.insert(TKeyframeSelection::Position(r0, newC0));
keyframeData->getKeyframes(positions);
selection.select(positions);
@@ -1787,8 +1790,12 @@ void TCellSelection::pasteKeyframesInto() {
} else {
// Retrieves all keyframe positions from mime data and translates them by
// (r0,c0)
+ XsheetViewer *viewer = TApp::instance()->getCurrentXsheetViewer();
std::set<TKeyframeSelection::Position> positions;
- positions.insert(TKeyframeSelection::Position(r0, c0));
+ int newC0 = c0;
+ if (viewer && !viewer->orientation()->isVerticalTimeline())
+ newC0 = c0 - keyframeData->getColumnSpanCount() + 1;
+ positions.insert(TKeyframeSelection::Position(r0, newC0));
keyframeData->getKeyframes(positions);
selection.select(positions);
}
diff --git a/toonz/sources/toonz/keyframedata.cpp b/toonz/sources/toonz/keyframedata.cpp
index b3afd6ebf..73f6bae9b 100644
--- a/toonz/sources/toonz/keyframedata.cpp
+++ b/toonz/sources/toonz/keyframedata.cpp
@@ -80,8 +80,6 @@ bool TKeyframeData::getKeyframes(std::set<Position> &positions,
}
XsheetViewer *viewer = TApp::instance()->getCurrentXsheetViewer();
- if (viewer && !viewer->orientation()->isVerticalTimeline())
- c0 -= m_columnSpanCount - 1;
positions.clear();
TStageObjectId cameraId = xsh->getStageObjectTree()->getCurrentCameraId();