510834-Selection-Move-Tool

Improve selection base tool to include move selection stroke strategy, allowing all selection tools to move pixels when clicking inside the selection region on the canvas.

Selection tools have a checkbox in the options widget, "Drag and Move", to enable the move feature. While the checkbox is not toggled, selection tools behave identically as they would without this feature; no changes have been made to the original selection functionality.

Ticket: #510834

Documentation merge request: documentation/docs-krita-org!376 (merged)

Keywords: GUI

Test Plan


New Feature Test
  • Run Krita
    • Any device
    • Any operating system
  • Create a project or open an existing project
  • Paint anywhere
    • Ideally a collection of pixels or a hollow shape such as a triangle or square
  • Select any Selection tool
    • Enable pixel mode
    • Toggle the Drag and Move checkbox
  • Click and drag across the canvas to select a region encompassing the pixels
    • The stroke should begin
    • The pixels should move under your cursor with the selection region
  • Release
    • The pixels should not bake to the canvas
    • The stroke should not end
  • Press Enter or whichever key you have configured as Enter
    • Note: not Return, but Enter
    • The stroke should end and the pixels should be baked into the canvas
  • Click and drag across the canvas to select a region encompassing the pixels
    • The stroke should begin
    • The pixels should move under your cursor with the selection region
  • Release
    • The pixels should not bake to the canvas
    • The stroke should not end
  • Press Escape or whichever key you have configured as Escape
    • Stroke should cancel
    • Pixels should return to original transforms
    • Finally, stroke should end

Backwards Compatibility Test
  • Click and drag along the edge of the selection region
    • The selection region should move
    • No pixels on the canvas should be transformed as a result of this action
  • Click anywhere outside of the selection region and drag across the canvas to select any arbitrary region
    • A new selection region should be created
    • No pixels on the canvas should be transformed as a result of this action
  • Uncheck the Drag and Move checkbox
  • Click inside the selection region
    • A new selection region should replace the existing selection region
  • Create a new selection region
  • Click inside the selection region
    • A new selection region should replace the existing selection region

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
  • Does the patch add a user-visible feature? If yes, is there a documentation MR ready for it at Krita Documentation Repository?

Reminder: the reviewer is responsible for merging the patch, this is to ensure at the least two people can build the patch. In case a patch breaks the build, both the author and the reviewer should be contacted to fix the build. If this is not possible, the commits shall be reverted, and a notification with the reasoning and any relevant logs shall be sent to the mailing list, kimageshop@kde.org**.**

Edited by Ricky Ringler

Merge request reports

Loading