mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-30 06:32:42 +00:00
Merge branch 'HunterNN-master'
This commit is contained in:
commit
b62c1e195f
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2001-2015 David Capello
|
// Copyright (C) 2001-2016 David Capello
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License version 2 as
|
// it under the terms of the GNU General Public License version 2 as
|
||||||
@ -116,15 +116,9 @@ bool DrawingState::onMouseDown(Editor* editor, MouseMessage* msg)
|
|||||||
// Notify the mouse button down to the tool loop manager.
|
// Notify the mouse button down to the tool loop manager.
|
||||||
m_toolLoopManager->pressButton(pointer_from_msg(editor, msg));
|
m_toolLoopManager->pressButton(pointer_from_msg(editor, msg));
|
||||||
|
|
||||||
// Cancel drawing loop
|
// The user might have canceled by the tool loop clicking with the
|
||||||
if (m_toolLoopManager->isCanceled()) {
|
// secondary mouse button.
|
||||||
destroyLoop(editor);
|
destroyLoopIfCanceled(editor);
|
||||||
|
|
||||||
// Change to standby state
|
|
||||||
editor->backToPreviousState();
|
|
||||||
editor->releaseMouse();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,6 +209,9 @@ bool DrawingState::onKeyDown(Editor* editor, KeyMessage* msg)
|
|||||||
bool DrawingState::onKeyUp(Editor* editor, KeyMessage* msg)
|
bool DrawingState::onKeyUp(Editor* editor, KeyMessage* msg)
|
||||||
{
|
{
|
||||||
m_toolLoopManager->releaseKey(msg->scancode());
|
m_toolLoopManager->releaseKey(msg->scancode());
|
||||||
|
|
||||||
|
// The user might have canceled the tool loop pressing the 'Esc' key.
|
||||||
|
destroyLoopIfCanceled(editor);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,6 +228,18 @@ void DrawingState::onExposeSpritePixels(const gfx::Region& rgn)
|
|||||||
m_toolLoop->validateDstImage(rgn);
|
m_toolLoop->validateDstImage(rgn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawingState::destroyLoopIfCanceled(Editor* editor)
|
||||||
|
{
|
||||||
|
// Cancel drawing loop
|
||||||
|
if (m_toolLoopManager->isCanceled()) {
|
||||||
|
destroyLoop(editor);
|
||||||
|
|
||||||
|
// Change to standby state
|
||||||
|
editor->backToPreviousState();
|
||||||
|
editor->releaseMouse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DrawingState::destroyLoop(Editor* editor)
|
void DrawingState::destroyLoop(Editor* editor)
|
||||||
{
|
{
|
||||||
if (editor) {
|
if (editor) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2001-2015 David Capello
|
// Copyright (C) 2001-2016 David Capello
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License version 2 as
|
// it under the terms of the GNU General Public License version 2 as
|
||||||
@ -37,6 +37,7 @@ namespace app {
|
|||||||
void initToolLoop(Editor* editor, ui::MouseMessage* msg);
|
void initToolLoop(Editor* editor, ui::MouseMessage* msg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void destroyLoopIfCanceled(Editor* editor);
|
||||||
void destroyLoop(Editor* editor);
|
void destroyLoop(Editor* editor);
|
||||||
|
|
||||||
// The tool-loop.
|
// The tool-loop.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user