diff --git a/toonz/sources/include/tools/tool.h b/toonz/sources/include/tools/tool.h index 6764748..59ee74a 100644 --- a/toonz/sources/include/tools/tool.h +++ b/toonz/sources/include/tools/tool.h @@ -513,6 +513,9 @@ transformation. // Tools. virtual bool isPencilModeActive() { return false; } + // return true if the tool is busy with a mouse drag operation + virtual bool isDragging() const { return false; }; + void setSelectedFrames(const std::set &selectedFrames); static const std::set &getSelectedFrames() { return m_selectedFrames; diff --git a/toonz/sources/tnztools/vectorselectiontool.cpp b/toonz/sources/tnztools/vectorselectiontool.cpp index 114d7a7..66b46b7 100644 --- a/toonz/sources/tnztools/vectorselectiontool.cpp +++ b/toonz/sources/tnztools/vectorselectiontool.cpp @@ -1990,6 +1990,12 @@ void VectorSelectionTool::onImageChanged() { //----------------------------------------------------------------------------- +bool VectorSelectionTool::isDragging() const { + return m_enabled && m_leftButtonMousePressed; +} + +//----------------------------------------------------------------------------- + void VectorSelectionTool::doOnDeactivate() { m_strokeSelection.selectNone(); m_levelSelection.selectNone(); diff --git a/toonz/sources/tnztools/vectorselectiontool.h b/toonz/sources/tnztools/vectorselectiontool.h index 29df53b..441b307 100644 --- a/toonz/sources/tnztools/vectorselectiontool.h +++ b/toonz/sources/tnztools/vectorselectiontool.h @@ -338,6 +338,8 @@ protected: return m_cursorId; } + bool isDragging() const override; + private: class AttachedLevelSelection final : public LevelSelection { StrokeSelection &m_strokeSelection; //!< Selection of strokes to be seen at diff --git a/toonz/sources/toonz/sceneviewerevents.cpp b/toonz/sources/toonz/sceneviewerevents.cpp index add2680..6539fc6 100644 --- a/toonz/sources/toonz/sceneviewerevents.cpp +++ b/toonz/sources/toonz/sceneviewerevents.cpp @@ -1191,6 +1191,12 @@ bool SceneViewer::event(QEvent *e) { e->accept(); } + // Disable keyboard shortcuts while the tool is busy with a mouse drag + // operation. + if ( tool->isDragging() ) { + e->accept(); + } + return true; } if (e->type() == QEvent::KeyRelease) {