rnote icon indicating copy to clipboard operation
rnote copied to clipboard

Improv : logic changes for selection cancellation

Open Doublonmousse opened this issue 8 months ago • 4 comments

Fixes #414 Fixes #888

  • This fixes the small dots that appears on selection cancellation with the pen (whilst allowing for strokes to still be written if they're larger than small dots)

A couple remarks :

  • ~~shapes need an additional up/down cycle : we could change it to follow the same logic as the brush but this could also be done by not changing the logic of the shape part and only disallowing shapes to be too small (in that case we can create shapes that aren't even visible but are still part of the document)~~
  • the eraser and typewriter both need an additional pen up/down to activate
  • tools aren't affected (they won't change anything if they're activated on such a short pen down/up cycle)
  • ~~This does not change behavior when a selection is deleted.~~

Rebase of the previous PR #1139 with the new clone! syntax

I've added a condition to only create shapes if they're large enough. As things like arrows would still appear on a single pen event, I'll leave the current behavior for shapes after a selection cancellation (that is we need an extra up/down cycle)

I've added the cancellation of the selection tool upon deleting a selection when the selection tool is temporary

Putting back in draft as this needs a little work before it can be merged. I'm wondering if the condition can be slightly modified to include time delay as well. It will cancel a dot after a selection but sometimes this dot can be large enough to stay (if the pen slides a bit instead of a clean hit)

Doublonmousse avatar Apr 06 '25 15:04 Doublonmousse

I've added a commit to fix #888. This last commit needs some testing (and maybe some renaming) to be sure everything works as expected.

Doublonmousse avatar Apr 07 '25 17:04 Doublonmousse

Rebased to main, seems to compile/work as before. I think I still need to retest on tablet though

Doublonmousse avatar May 10 '25 16:05 Doublonmousse

Retested and working almost as intended.

On smaller stroke width, the heuristic I'm using for cancelling small strokes doesn't work very well (volume comparison to a * stroke_width ^ 2). It works if the pen is orthogonal to the surface but will still leaves traces behind if you slip a little.

Maybe calculating the perimeter of the outline and comparing it to a fixed threshold * zoom will work better (so that we essentially check whether the stroke path is small or not compared to the current view). I'll try but if that still fails I'll fallback to an additional up/down cycle

Doublonmousse avatar May 11 '25 10:05 Doublonmousse

I've changed the computation for the cancellation. It seems to work better though not totally foolproof. I'm still on the fence about switching back to an additional up/down cycle for the selection cancellation to pen stroke situation. Other that than, does what I expect

Doublonmousse avatar May 11 '25 13:05 Doublonmousse