Skip to content

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

C

Improve deactivate behaviour for brush (#2694)

Martin van Zijl2420a85267e1
diff --git a/toonz/sources/tnztools/toonzvectorbrushtool.cpp b/toonz/sources/tnztools/toonzvectorbrushtool.cpp
index c5391591a..0a54da8f1 100644
--- a/toonz/sources/tnztools/toonzvectorbrushtool.cpp
+++ b/toonz/sources/tnztools/toonzvectorbrushtool.cpp
@@ -625,6 +625,12 @@ void ToonzVectorBrushTool::onDeactivate() {
/*---
* �h���b�O���Ƀc�[�����؂�ւ�����ꍇ�ɔ����AonDeactivate�ɂ�MouseRelease�Ɠ����������s��
* ---*/
+
+ // End current stroke.
+ if (m_active && m_enabled) {
+ leftButtonUp(m_lastDragPos, m_lastDragEvent);
+ }
+
if (m_tileSaver && !m_isPath) {
m_enabled = false;
}
@@ -718,6 +724,10 @@ void ToonzVectorBrushTool::leftButtonDrag(const TPointD &pos,
m_brushPos = m_mousePos = pos;
return;
}
+
+ m_lastDragPos = pos;
+ m_lastDragEvent = e;
+
double thickness = (m_pressure.getValue() || m_isPath)
? computeThickness(e.m_pressure, m_thickness, m_isPath)
: m_thickness.getValue().second * 0.5;
diff --git a/toonz/sources/tnztools/toonzvectorbrushtool.h b/toonz/sources/tnztools/toonzvectorbrushtool.h
index 887da3920..21fad2313 100644
--- a/toonz/sources/tnztools/toonzvectorbrushtool.h
+++ b/toonz/sources/tnztools/toonzvectorbrushtool.h
@@ -192,6 +192,9 @@ protected:
��ƒ���FrameId���N���b�N���ɕۑ����A�}�E�X�����[�X���iUndo�̓o�^���j�ɕʂ̃t���[����
�ړ����Ă����Ƃ��̕s����C������B---*/
TFrameId m_workingFrameId;
+
+ TPointD m_lastDragPos; //!< Position where mouse was last dragged.
+ TMouseEvent m_lastDragEvent; //!< Previous mouse-drag event.
};
#endif // TOONZVECTORBRUSHTOOL_H