From 01dafaf33ab6d052f99348cdfdf9861a55446117 Mon Sep 17 00:00:00 2001 From: shun-iwasawa Date: Mar 27 2021 22:27:03 +0000 Subject: fix geometric tool / type tool offset --- diff --git a/toonz/sources/tnztools/geometrictool.cpp b/toonz/sources/tnztools/geometrictool.cpp index d7f3370..52d0838 100644 --- a/toonz/sources/tnztools/geometrictool.cpp +++ b/toonz/sources/tnztools/geometrictool.cpp @@ -1022,19 +1022,23 @@ public: } } + bool preLeftButtonDown() override { + if (getViewer() && getViewer()->getGuidedStrokePickerMode()) return false; + + if (!getApplication()->getCurrentObject()->isSpline()) + // NEEDS to be done even if(m_active), due + // to the HORRIBLE m_frameCreated / m_levelCreated + // mechanism. touchImage() is the ONLY function + // resetting them to false... >_< + m_active = !!touchImage(); + return true; + } + void leftButtonDown(const TPointD &p, const TMouseEvent &e) override { if (getViewer() && getViewer()->getGuidedStrokePickerMode()) { getViewer()->doPickGuideStroke(p); return; } - - /* m_active = getApplication()->getCurrentObject()->isSpline() || - (bool) getImage(true);*/ - if (!getApplication()->getCurrentObject()->isSpline()) - m_active = touchImage(); // NEEDS to be done even if(m_active), due - if (!m_active) // to the HORRIBLE m_frameCreated / m_levelCreated - return; // mechanism. touchImage() is the ONLY function - // resetting them to false... >_< if (m_primitive) m_primitive->leftButtonDown(p, e); invalidate(); } diff --git a/toonz/sources/tnztools/typetool.cpp b/toonz/sources/tnztools/typetool.cpp index d495d25..d62bffc 100644 --- a/toonz/sources/tnztools/typetool.cpp +++ b/toonz/sources/tnztools/typetool.cpp @@ -358,6 +358,7 @@ public: void setCursorIndexFromPoint(TPointD point); void mouseMove(const TPointD &pos, const TMouseEvent &) override; + bool preLeftButtonDown() override; void leftButtonDown(const TPointD &pos, const TMouseEvent &) override; void rightButtonDown(const TPointD &pos, const TMouseEvent &) override; bool keyDown(QKeyEvent *event) override; @@ -1201,6 +1202,16 @@ void TypeTool::mouseMove(const TPointD &pos, const TMouseEvent &) { //--------------------------------------------------------- +bool TypeTool::preLeftButtonDown() { + if (getViewer() && getViewer()->getGuidedStrokePickerMode()) return false; + + if (m_validFonts && !m_active) + touchImage(); + return true; +} + +//--------------------------------------------------------- + void TypeTool::leftButtonDown(const TPointD &pos, const TMouseEvent &) { TSelection::setCurrent(0); @@ -1211,11 +1222,7 @@ void TypeTool::leftButtonDown(const TPointD &pos, const TMouseEvent &) { if (!m_validFonts) return; - TImageP img; - if (!m_active) - img = touchImage(); - else - img = getImage(true); + TImageP img = getImage(true); TVectorImageP vi = img; TToonzImageP ti = img;