OpenToonz - An open-source full-featured 2D animation creation software
C
fix shift and trace scaling (#3877)
shun-iwasawa92418ac738da
diff --git a/toonz/sources/tnztools/shifttracetool.cpp b/toonz/sources/tnztools/shifttracetool.cppindex 785767c42..b1fcdcfdb 100644--- a/toonz/sources/tnztools/shifttracetool.cpp+++ b/toonz/sources/tnztools/shifttracetool.cpp@@ -529,15 +529,17 @@ void ShiftTraceTool::leftButtonDrag(const TPointD &pos, const TMouseEvent &e) {m_oldPos = pos;m_aff[m_ghostIndex] = TTranslation(delta) * m_aff[m_ghostIndex];} else if (m_gadget == ScaleGadget) {- TAffine aff = getGhostAff();- TPointD c = aff * m_center[m_ghostIndex];- TPointD a = m_oldPos - c;- TPointD b = pos - c;+ TAffine aff = getGhostAff();+ TPointD c = m_center[m_ghostIndex];+ TPointD a = aff.inv() * m_oldPos - c;+ TPointD b = aff.inv() * pos - c;+ TPointD imgC = aff * m_center[m_ghostIndex];+if (e.isShiftPressed())- m_aff[m_ghostIndex] = m_oldAff * TScale(b.x / a.x, b.y / a.y);+ m_aff[m_ghostIndex] = TScale(imgC, b.x / a.x, b.y / a.y) * m_oldAff;else {double scale = std::max(b.x / a.x, b.y / a.y);- m_aff[m_ghostIndex] = m_oldAff * TScale(scale, scale);+ m_aff[m_ghostIndex] = TScale(imgC, scale) * m_oldAff;}}