fix geometric tool / type tool offset

This commit is contained in:
shun-iwasawa 2021-03-28 07:27:03 +09:00 committed by manongjohn
parent 4cb2f6fd40
commit 8358fc99ce
2 changed files with 24 additions and 13 deletions

View file

@ -1032,19 +1032,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();
}

View file

@ -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;