-
-
Notifications
You must be signed in to change notification settings - Fork 369
Improv : logic changes for selection cancellation #1405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
fixes bug where large vertical or horizontal elements would get cancelled
apply corrections - move actions logic into `trash_selection` - small rename of canceled* to have coherent naming between variables and functions getters/settesr - move comment closer to the `canceled_state` variable (variable-level docstring) - constant added as such fmt and hashset
…hortcuts and pass to pens This adds a `temporary_tool` bool to the `PenHolder` which signifies whether the following sequence occured (for now only with the selector) 1. activates the selector 2. Select something then lift the pen (triggering an up or cancel event) 3. go back with the selector activated via a temporary shortcut 4. Select something else Then the temporary style will be `true` as going back will trigger again the `handle_pressed_shortcut_key` function on the pen down event.
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. |
Rebased to main, seems to compile/work as before. |
// we activated the temporary mode for the selector and | ||
// clicked outside the selection. We expect to be able | ||
// to do another selection | ||
self.state = SelectorState::Selecting { path: Vec::new() }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking maybe having a 'if shift' condition here would be good (so doing shift + new selection can add to what's already here).
Now that would mean we'd have to change the SelectorState strcture (so that we can select and have the previous selection still saved as an optional)
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). |
This is a little more robust that volume as tiny spots tend to be single elements or small lines. The perimeter also increase quite rapidly with non line elements. The threshold is placed quite high (to limit unwanted spots)
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. |
Fixes #414
Fixes #888
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)This does not change behavior when a selection is deleted.Rebase of the previous PR #1139 with the new clone! syntax