mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-05 21:57:20 +00:00
Avoid creating consecutive SelectBoxStates with Ctrl+B
If we press several times Ctrl+B, we could create several SelectBoxStates, and as it backs to the previous state, it's like we will select several brushes instead of backing to the original state.
This commit is contained in:
parent
f09db4d9aa
commit
058682bcaa
@ -65,6 +65,13 @@ void NewBrushCommand::onExecute(Context* context)
|
||||
// If there is no visible mask, the brush must be selected from the
|
||||
// current editor.
|
||||
if (!context->activeDocument()->isMaskVisible()) {
|
||||
EditorStatePtr state = current_editor->getState();
|
||||
if (dynamic_cast<SelectBoxState*>(state.get())) {
|
||||
// If already are in "SelectBoxState" state, in this way we
|
||||
// avoid creating a stack of several "SelectBoxState" states.
|
||||
return;
|
||||
}
|
||||
|
||||
current_editor->setState(
|
||||
EditorStatePtr(
|
||||
new SelectBoxState(
|
||||
|
Loading…
Reference in New Issue
Block a user