pencil icon indicating copy to clipboard operation
pencil copied to clipboard

Assertion failure when selection is moved with arrows

Open scribblemaniac opened this issue 1 year ago • 0 comments

Issue Summary

The selection can be modified using the arrow keys without using the move tool, breaking some of the assumptions of canvaspainter.

Actual Results

When a selection is made, moved with the arrow keys and then the canvas is painted on with a drawing tool, all without selecting the move tool, then this assert will be triggered, and crash on debug builds.

If the assert is ignored, as it would be in a release build, then the selection does not get applied before drawing and the drawing tool will behave as if the selection has not been transformed. This will result in some visual anomalies as the brush data conflicts with the selection data. After each stroke is finished, the program behaves as if the stroke had been drawn before the selection was transformed, and the selection remains active with a transformation.

Expected Results

It is expected that the assert does not fail obviously. Perhaps the easiest and best solution would be for the arrow key shortcuts to only transform selections while the move tool is active. It would also make sense to be able to move the selection bounds (without the content) with the arrow keys when the select tool is active.

Steps to reproduce

  1. Create a selection.
  2. Switch to the pen tool.
  3. Use the arrow keys to move the selection.
  4. Attempt to draw through the selection with the pen tool.

System Information

  • Pencil2D Version: ac11a81
  • Operating System: Ubuntu 22.04
  • RAM Size: 16GB
  • Graphics Tablet: N/A

Developer Notes

This issue was previously noted in the PR in which it was introduced (https://github.com/pencil2d/pencil/pull/1807#issuecomment-1902509450), though after it had already been merged. I have created this separate issue for tracking purposes.

scribblemaniac avatar Apr 29 '24 03:04 scribblemaniac