Possibility to Add/Subtract selection inside the selection

https://community.aseprite.org/t/470
This commit is contained in:
David Capello 2017-09-27 13:07:37 -03:00
parent 6ca76c0ca9
commit ec2a1f229d
3 changed files with 17 additions and 2 deletions

View File

@ -1891,6 +1891,16 @@ bool Editor::isInsideSelection()
m_document->mask()->containsPoint(spritePos.x, spritePos.y);
}
bool Editor::canStartMovingSelectionPixels()
{
return
(isInsideSelection()) &&
// In this way we cannot move the selection when add/subtract
// modes are enabled (we prefer to modify the selection on those
// modes instead of moving pixels).
(int(m_toolLoopModifiers) & int(tools::ToolLoopModifiers::kReplaceSelection));
}
EditorHit Editor::calcHit(const gfx::Point& mouseScreenPos)
{
tools::Ink* ink = getCurrentEditorInk();

View File

@ -199,6 +199,11 @@ namespace app {
// Returns true if the cursor is inside the active mask/selection.
bool isInsideSelection();
// Returns true if the cursor is inside the selection and the
// selection mode is the default one which prioritizes and easy
// way to move the selection.
bool canStartMovingSelectionPixels();
// Returns the element that will be modified if the mouse is used
// in the given position.
EditorHit calcHit(const gfx::Point& mouseScreenPos);

View File

@ -283,7 +283,7 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg)
}
// Move selected pixels
if (layer && editor->isInsideSelection() && msg->left()) {
if (layer && editor->canStartMovingSelectionPixels() && msg->left()) {
if (!layer->isEditableHierarchy()) {
StatusBar::instance()->showTip(1000,
"Layer '%s' is locked", layer->name().c_str());
@ -411,7 +411,7 @@ bool StandbyState::onSetCursor(Editor* editor, const gfx::Point& mouseScreenPos)
}
// Move pixels
if (editor->isInsideSelection()) {
if (editor->canStartMovingSelectionPixels()) {
EditorCustomizationDelegate* customization = editor->getCustomizationDelegate();
if ((customization) &&
int(customization->getPressedKeyAction(KeyContext::TranslatingSelection) & KeyAction::CopySelection))