rnote icon indicating copy to clipboard operation
rnote copied to clipboard

Ability to select one object by tapping when in "Select with a polygon" or "Select with a region"

Open Excigma opened this issue 1 year ago • 5 comments

Xournal++ has this feature where, even if if you're in their equivalent of "Select With a Rectangle" or "Select With a Polygon" mode, if you tap (without dragging) on a stroke or image, it will select it like a 'one-shot' "Select One by One" mode.

This makes using a stylus more much ergonomic, as you will be able to select long lines or large images easily in "Select With a Polygon" or "Select With a Rectangle" mode, especially if there are foreground strokes that you do not want to select. Basically the benefits of "Select One by One", but more easily accessible.

I've done a poor attempt of showing it from a screen recording, a video showing the stylus input would have been more appropriate.

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
Tapping on a stroke or image whilst in "Select With a Polygon" or "Select With a Rectangle" mode will act like a one-shot "Select One by One".

Exact implementation may differ, but personally, I would prefer it to allow only one item to be selected. That is, if multiple strokes/images are tapped, the previous selection is cleared. This is subjective though, some people may prefer it to work like "Select One by One"

Describe alternatives you've considered
I suppose "Select Intersecting Path" is a possible trade off. I still see myself using "Select With a Polygon" as I wouldn't miss small dashes

Additional context

Screencast From 2024-09-22 22-42-01.webm

Excigma avatar Sep 22 '24 10:09 Excigma

Are you aware of the one-by-one selection mode that already exists - you can select it in the sidebar below "rectangle" / "polygon" mode. It sounds like it is exactly what you're looking for.

flxzt avatar Sep 22 '24 15:09 flxzt

Yup - this would make it easier to select images without needing to switch between the modes though (I have a flip laptop and palm rejection is a little finicky, touchscreen input is ignored when the pen is close to the screen, which makes tapping to change tools often a bit difficult as the touch is sometimes ignored).

The idea of this is so that you can stay in "Select with a polygon" or "Select with a region" mode. Dragging would carry out the normal mode, but tapping on items would act like "Select One by One" and will select the item you tapped on instead

Excigma avatar Sep 22 '24 23:09 Excigma

I also support the addition of this feature

chrostino avatar Jun 14 '25 17:06 chrostino

@chrostino I had a bit of time and had a dig around to see how difficult it was to implement it. Turns out it seems quite trivial. In the video below, my selection mode is always on polygon selection mode, but for taps, it will select items.

https://github.com/user-attachments/assets/60e766be-b1d7-494c-8e9d-bf3e42978b0b

The patches at in this folder: https://github.com/Excigma/dotfiles/tree/389955ee9bf8e5bfc0a9f77cea99bbadf6ee95f8/modules/overlays/patches as https://github.com/Excigma/dotfiles/blob/trunk/modules/overlays/patches/rnote-tap-to-select-latest.patch (for the main branch) and https://github.com/Excigma/dotfiles/blob/trunk/modules/overlays/patches/rnote-tap-to-select.patch (for v0.12.0 - which my distro is on)

I'm using a magic number; if path.len() < 10 to treat very short lines as a tap. This may not be correct or wanted behavour - checking the pen down duration, or how straight the line is might be a better heuristic, but this works well enough for me, and I'm slightly lazy to implement something more, unless there is more desire for this feature to be upstreamed.

I'm unsure if this is a wanted change, so I have not opened a pull request for this.

Excigma avatar Jun 15 '25 00:06 Excigma

I'm using a magic number; if path.len() < 10 to treat very short lines as a tap

Maybe a perimeter would be better here? (cumulative length of the polygon perimeter). The path len can probably get larger by virtue of having a higher refresh rate if we don't limit the events for the selector (not sure if this active for the selector though). To test though (maybe this is fine after all).

What we should make sure is that there isn't a too high risk of false positive (do a precise lasso selection on a small portion of the canvas and activating the single mode and selecting a large stroke larger than the selection. In lasso mode the stroke has to be fully contained to be counted)

Doublonmousse avatar Jun 16 '25 06:06 Doublonmousse