mirror of https://github.com/aseprite/aseprite.git
				
				
				
			Possibility to Add/Subtract selection inside the selection
https://community.aseprite.org/t/470
This commit is contained in:
		
							parent
							
								
									6ca76c0ca9
								
							
						
					
					
						commit
						ec2a1f229d
					
				| 
						 | 
				
			
			@ -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();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue