mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-06 03:39:51 +00:00
Now we can press Shift+Alt in any order to use subtract mode in selection tools
Fixes #1972, related to #1626
This commit is contained in:
parent
f4878c7bb8
commit
b427969b26
@ -1472,9 +1472,6 @@ void ContextBar::updateForSelectingBox(const std::string& text)
|
|||||||
|
|
||||||
void ContextBar::updateToolLoopModifiersIndicators(tools::ToolLoopModifiers modifiers)
|
void ContextBar::updateToolLoopModifiersIndicators(tools::ToolLoopModifiers modifiers)
|
||||||
{
|
{
|
||||||
if (!m_selectionMode->isVisible())
|
|
||||||
return;
|
|
||||||
|
|
||||||
gen::SelectionMode mode = gen::SelectionMode::DEFAULT;
|
gen::SelectionMode mode = gen::SelectionMode::DEFAULT;
|
||||||
if (int(modifiers) & int(tools::ToolLoopModifiers::kAddSelection))
|
if (int(modifiers) & int(tools::ToolLoopModifiers::kAddSelection))
|
||||||
mode = gen::SelectionMode::ADD;
|
mode = gen::SelectionMode::ADD;
|
||||||
|
@ -1448,14 +1448,17 @@ void Editor::updateStatusBar()
|
|||||||
void Editor::updateQuicktool()
|
void Editor::updateQuicktool()
|
||||||
{
|
{
|
||||||
if (m_customizationDelegate && !hasCapture()) {
|
if (m_customizationDelegate && !hasCapture()) {
|
||||||
auto activeToolManager = App::instance()->activeToolManager();
|
auto atm = App::instance()->activeToolManager();
|
||||||
tools::Tool* selectedTool = activeToolManager->selectedTool();
|
tools::Tool* selectedTool = atm->selectedTool();
|
||||||
|
|
||||||
// Don't change quicktools if we are in a selection tool and using
|
// Don't change quicktools if we are in a selection tool and using
|
||||||
// the selection modifiers.
|
// the selection modifiers.
|
||||||
if (selectedTool->getInk(0)->isSelection() &&
|
if (selectedTool->getInk(0)->isSelection() &&
|
||||||
int(m_customizationDelegate->getPressedKeyAction(KeyContext::SelectionTool)) != 0)
|
int(m_customizationDelegate->getPressedKeyAction(KeyContext::SelectionTool)) != 0) {
|
||||||
|
if (atm->quickTool())
|
||||||
|
atm->newQuickToolSelectedFromEditor(nullptr);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
tools::Tool* newQuicktool =
|
tools::Tool* newQuicktool =
|
||||||
m_customizationDelegate->getQuickTool(selectedTool);
|
m_customizationDelegate->getQuickTool(selectedTool);
|
||||||
@ -1464,8 +1467,7 @@ void Editor::updateQuicktool()
|
|||||||
if (newQuicktool && !m_state->acceptQuickTool(newQuicktool))
|
if (newQuicktool && !m_state->acceptQuickTool(newQuicktool))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
activeToolManager
|
atm->newQuickToolSelectedFromEditor(newQuicktool);
|
||||||
->newQuickToolSelectedFromEditor(newQuicktool);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1489,6 +1491,8 @@ void Editor::updateToolLoopModifiersIndicators()
|
|||||||
KeyAction action;
|
KeyAction action;
|
||||||
|
|
||||||
if (m_customizationDelegate) {
|
if (m_customizationDelegate) {
|
||||||
|
auto atm = App::instance()->activeToolManager();
|
||||||
|
|
||||||
// When the mouse is captured, is when we are scrolling, or
|
// When the mouse is captured, is when we are scrolling, or
|
||||||
// drawing, or moving, or selecting, etc. So several
|
// drawing, or moving, or selecting, etc. So several
|
||||||
// parameters/tool-loop-modifiers are static.
|
// parameters/tool-loop-modifiers are static.
|
||||||
@ -1500,8 +1504,8 @@ void Editor::updateToolLoopModifiersIndicators()
|
|||||||
int(tools::ToolLoopModifiers::kIntersectSelection)));
|
int(tools::ToolLoopModifiers::kIntersectSelection)));
|
||||||
|
|
||||||
tools::Controller* controller =
|
tools::Controller* controller =
|
||||||
(App::instance()->activeToolManager()->selectedTool() ?
|
(atm->selectedTool() ?
|
||||||
App::instance()->activeToolManager()->selectedTool()->getController(0): nullptr);
|
atm->selectedTool()->getController(0): nullptr);
|
||||||
|
|
||||||
// Shape tools modifiers (line, curves, rectangles, etc.)
|
// Shape tools modifiers (line, curves, rectangles, etc.)
|
||||||
if (controller && controller->isTwoPoints()) {
|
if (controller && controller->isTwoPoints()) {
|
||||||
@ -1532,8 +1536,8 @@ void Editor::updateToolLoopModifiersIndicators()
|
|||||||
// Don't use "subtract" mode if the selection was activated
|
// Don't use "subtract" mode if the selection was activated
|
||||||
// with the "right click mode = a selection-like tool"
|
// with the "right click mode = a selection-like tool"
|
||||||
(m_secondaryButton &&
|
(m_secondaryButton &&
|
||||||
App::instance()->activeToolManager()->selectedTool() &&
|
atm->selectedTool() &&
|
||||||
App::instance()->activeToolManager()->selectedTool()->getInk(0)->isSelection())) {
|
atm->selectedTool()->getInk(0)->isSelection())) {
|
||||||
mode = gen::SelectionMode::SUBTRACT;
|
mode = gen::SelectionMode::SUBTRACT;
|
||||||
}
|
}
|
||||||
else if (int(action & KeyAction::IntersectSelection)) {
|
else if (int(action & KeyAction::IntersectSelection)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user