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:
David Capello 2015-04-28 12:46:50 -03:00
parent f09db4d9aa
commit 058682bcaa

View File

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