mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-01 00:23:35 +00:00
When we are in pixels-movement loop, drop pixels when the user selects other tool (that is not marquee, lasso, or magic wand).
This commit is contained in:
parent
9f68fd459d
commit
f8bbc19b22
@ -195,6 +195,7 @@ public:
|
||||
|
||||
protected:
|
||||
bool onProcessMessage(JMessage msg);
|
||||
void onCurrentToolChange();
|
||||
|
||||
private:
|
||||
void drawGrid(const Rect& gridBounds, color_t color);
|
||||
|
@ -104,6 +104,8 @@ Editor::Editor()
|
||||
m_pixelsMovement = NULL;
|
||||
|
||||
jwidget_focusrest(this, true);
|
||||
|
||||
App::instance()->CurrentToolChange.connect(&Editor::onCurrentToolChange, this);
|
||||
}
|
||||
|
||||
Editor::~Editor()
|
||||
@ -1508,6 +1510,22 @@ bool Editor::onProcessMessage(JMessage msg)
|
||||
return Widget::onProcessMessage(msg);
|
||||
}
|
||||
|
||||
// When the current tool is changed
|
||||
void Editor::onCurrentToolChange()
|
||||
{
|
||||
UIContext* context = UIContext::instance();
|
||||
Tool* current_tool = context->getSettings()->getCurrentTool();
|
||||
|
||||
// If the user changed the tool when he/she is moving pixels,
|
||||
// we have to drop the pixels only if the new tool is not selection...
|
||||
if (m_pixelsMovement &&
|
||||
(!current_tool->getInk(0)->isSelection() ||
|
||||
!current_tool->getInk(1)->isSelection())) {
|
||||
// We have to drop pixels
|
||||
dropPixels();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns size for the editor viewport
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user