mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-11 18:41:05 +00:00
We can cancel the selection of the brush using the other mouse button
This commit is contained in:
parent
8f500178fc
commit
274b903aad
@ -42,6 +42,7 @@ protected:
|
||||
|
||||
// SelectBoxDelegate impl
|
||||
void onQuickboxEnd(const gfx::Rect& rect, ui::MouseButtons buttons) override;
|
||||
void onQuickboxCancel() override;
|
||||
|
||||
private:
|
||||
void createBrush(const Mask* mask);
|
||||
@ -116,6 +117,11 @@ void NewBrushCommand::onQuickboxEnd(const gfx::Rect& rect, ui::MouseButtons butt
|
||||
current_editor->backToPreviousState();
|
||||
}
|
||||
|
||||
void NewBrushCommand::onQuickboxCancel()
|
||||
{
|
||||
current_editor->backToPreviousState();
|
||||
}
|
||||
|
||||
void NewBrushCommand::createBrush(const Mask* mask)
|
||||
{
|
||||
doc::ImageRef image(new_image_from_mask(
|
||||
|
@ -80,6 +80,7 @@ bool SelectBoxState::onMouseDown(Editor* editor, MouseMessage* msg)
|
||||
|
||||
if (hasFlag(QUICKBOX) && m_movingRuler == -1) {
|
||||
m_selectingBox = true;
|
||||
m_selectingButtons = msg->buttons();
|
||||
m_startingPos = editor->screenToEditor(msg->position());
|
||||
setBoxBounds(gfx::Rect(m_startingPos, gfx::Size(1, 1)));
|
||||
}
|
||||
@ -96,8 +97,13 @@ bool SelectBoxState::onMouseUp(Editor* editor, MouseMessage* msg)
|
||||
|
||||
if (m_selectingBox) {
|
||||
m_selectingBox = false;
|
||||
if (m_delegate)
|
||||
m_delegate->onQuickboxEnd(getBoxBounds(), msg->buttons());
|
||||
|
||||
if (m_delegate) {
|
||||
if (m_selectingButtons == msg->buttons())
|
||||
m_delegate->onQuickboxEnd(getBoxBounds(), msg->buttons());
|
||||
else
|
||||
m_delegate->onQuickboxCancel();
|
||||
}
|
||||
}
|
||||
|
||||
return StandbyState::onMouseUp(editor, msg);
|
||||
|
@ -29,6 +29,7 @@ namespace app {
|
||||
// Called only in QUICKBOX mode, when the user released the mouse
|
||||
// button.
|
||||
virtual void onQuickboxEnd(const gfx::Rect& rect, ui::MouseButtons buttons) { }
|
||||
virtual void onQuickboxCancel() { }
|
||||
};
|
||||
|
||||
class SelectBoxState : public StandbyState
|
||||
@ -77,6 +78,7 @@ namespace app {
|
||||
Rulers m_rulers;
|
||||
int m_movingRuler;
|
||||
bool m_selectingBox;
|
||||
ui::MouseButtons m_selectingButtons;
|
||||
gfx::Point m_startingPos;
|
||||
Flags m_flags;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user