mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-30 04:20:23 +00:00
Add possibility to cancel brush creation with Esc key
This commit is contained in:
parent
d0962eb737
commit
640800259d
@ -17,6 +17,7 @@
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "app/ui/main_window.h"
|
||||
#include "app/ui/skin/skin_theme.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "doc/image.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "gfx/rect.h"
|
||||
@ -267,6 +268,24 @@ bool SelectBoxState::onSetCursor(Editor* editor, const gfx::Point& mouseScreenPo
|
||||
return StandbyState::onSetCursor(editor, mouseScreenPos);
|
||||
}
|
||||
|
||||
bool SelectBoxState::onKeyDown(Editor* editor, ui::KeyMessage* msg)
|
||||
{
|
||||
if (editor != UIContext::instance()->activeEditor())
|
||||
return false;
|
||||
|
||||
// Cancel
|
||||
if (msg->scancode() == kKeyEsc) {
|
||||
if (hasFlag(Flags::QuickBox)) {
|
||||
if (m_delegate)
|
||||
m_delegate->onQuickboxCancel(editor);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Use StandbyState implementation
|
||||
return StandbyState::onKeyDown(editor, msg);
|
||||
}
|
||||
|
||||
bool SelectBoxState::acceptQuickTool(tools::Tool* tool)
|
||||
{
|
||||
return false;
|
||||
|
@ -95,6 +95,7 @@ namespace app {
|
||||
virtual bool onMouseUp(Editor* editor, ui::MouseMessage* msg) override;
|
||||
virtual bool onMouseMove(Editor* editor, ui::MouseMessage* msg) override;
|
||||
virtual bool onSetCursor(Editor* editor, const gfx::Point& mouseScreenPos) override;
|
||||
virtual bool onKeyDown(Editor* editor, ui::KeyMessage* msg) override;
|
||||
virtual bool acceptQuickTool(tools::Tool* tool) override;
|
||||
virtual bool requireBrushPreview() override;
|
||||
virtual tools::Ink* getStateInk() override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user