Fix move symmetry when zoom tool is active (fix #1845)

This commit is contained in:
Gaspar Capello 2018-08-30 17:10:10 -03:00 committed by David Capello
parent 6eaebefb90
commit 7b4609d2d1

View File

@ -138,6 +138,24 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg)
// When an editor is clicked the current view is changed.
context->setActiveView(editor->getDocView());
// Move symmetry
Decorator::Handles handles;
if (m_decorator->getSymmetryHandles(editor, handles)) {
for (const auto& handle : handles) {
if (handle.bounds.contains(msg->position())) {
auto mode = (handle.align & (TOP | BOTTOM) ? app::gen::SymmetryMode::HORIZONTAL:
app::gen::SymmetryMode::VERTICAL);
bool horz = (mode == app::gen::SymmetryMode::HORIZONTAL);
auto& symmetry = Preferences::instance().document(editor->document()).symmetry;
auto& axis = (horz ? symmetry.xAxis:
symmetry.yAxis);
editor->setState(
EditorStatePtr(new MovingSymmetryState(editor, msg, mode, axis)));
return true;
}
}
}
// Start scroll loop
if (editor->checkForScroll(msg) ||
editor->checkForZoom(msg))
@ -297,24 +315,6 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg)
}
}
// Move symmetry
Decorator::Handles handles;
if (m_decorator->getSymmetryHandles(editor, handles)) {
for (const auto& handle : handles) {
if (handle.bounds.contains(msg->position())) {
auto mode = (handle.align & (TOP | BOTTOM) ? app::gen::SymmetryMode::HORIZONTAL:
app::gen::SymmetryMode::VERTICAL);
bool horz = (mode == app::gen::SymmetryMode::HORIZONTAL);
auto& symmetry = Preferences::instance().document(editor->document()).symmetry;
auto& axis = (horz ? symmetry.xAxis:
symmetry.yAxis);
editor->setState(
EditorStatePtr(new MovingSymmetryState(editor, msg, mode, axis)));
return true;
}
}
}
// Start the Tool-Loop
if (layer && (layer->isImage() || clickedInk->isSelection())) {
// Shift+click on Pencil tool starts a line onMouseDown() when the