Open
Conversation
axel-angel
commented
Sep 20, 2025
Comment on lines
+111
to
+112
| width = 2 * abs(start_x - current_selection->x); | ||
| height = 2 * abs(start_y - current_selection->y); |
Author
There was a problem hiding this comment.
Should we also include the +1 offset implemented below?
Comment on lines
+130
to
+131
| current_selection->selection.x = dist_x > 0 || seat->state->mirror_mode ? anchor_x : anchor_x - (width - 1); | ||
| current_selection->selection.y = dist_y > 0 || seat->state->mirror_mode ? anchor_y : anchor_y - (height - 1); |
Author
There was a problem hiding this comment.
Again, the -1 offset when dist is negative may be required for mirror mode. We may need to structure the code a bit differently to write the code only once.
PS: is the -1 to compensate the border? in that case we need to use state border_weight instead.
Author
commit 636efee addresss this issue making the transition predictable and flawless. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This implements a new mirror behavior while pressing Ctrl: the box selection will grow outwards from the starting selection (first click) symmetrically. This also works in conjunction with restricted aspect ratio (-a flag or shift key) and/or edit anchor (space key). The doc is also updated to mention this feature.
Demo follows.
capture2.mp4
The code isn't very straightforward, there may be a better way to implement this.
Also the behavior is a bit surprising when switching between regular and mirror mode, any idea is welcomed to do this differently.EDIT: demo updated with last change.