microsoft / microsoft/PowerToys
Grab And Move: Option to not change sides mid-resize
- Dominant language
- C
- Stars
- 139k
- Forks
- 8.6k
- PR merge metrics
- PR metrics pending
Description
### Description of the new feature / enhancement
Grab And Move's resize function currently divides the window into 8 regions, which each lock the resizing to particular sides (horizontal only, vertical only, or both). That much makes sense. But the issue is, as you perform the drag, there are several scenarios that can cause it to suddenly switch which sides you're affecting:
**A) Corner drags locking to least-used axis**
1. Start a right-click drag in the lower-right corner region of the window, but, relatively far from the actual corner (i.e. in order to best demonstrate the problem, as close to the center of the window as you can while still achieving a diagonal resize).
2. Drag much more leftwards than you do upwards.
3. As the window resizes, the (invisible) bounds of the 'corner' region resize proportionally along with the window, but your cursor remains a fixed distance from the edge, which causes the corner region to slip out from under your cursor, resulting in your cursor now being considered over the *lower* edge region
4. The window is now locked into only being able to resize VERTICALLY even though you're in the middle of a drag that has demonstrably been trying mostly to resize it HORIZONTALLY!
5. You can still slide your cursor to the right to make the window *bigger* again horizontally, but you've effectively hit a minimum width for the window unless you let go of the drag and start a new one positioned more carefully (which defeats the purpose of using Grab And Move's quick resize rather than just the default Windows resize).
**B) Edge drags flip from "shrink this side" to "grow other side"**
1. Start a right-click drag in the right edge region of the window, so that you can only resize the window horizontally. (Again, the further from the edge the better for demonstrating the problem -- which is a common use case, since if I were to always go all the way to the edge, I wouldn't have any reason to be using Grab And Move.)
2. Drag your cursor to the left, with a rapid 'flick' mouse movement. (This also happens with slow moves, but it's even more pronounced when travelling quickly, possibly because the regions seem to update one frame behind the actual window dimensions?)
3. At some point during this flick, Grab And Move has determined that your cursor is now over the *left* edge region of the window, which means that you're now pulling the left edge and not the right one.
4. Despite starting this gesture by grabbing the right edge of the window and making it narrower, you now wind up with a window that is only slightly narrower on the right, and much much wider on the left than when you started.
5. It will often now be impossible to make the window any narrower again without letting go, moving your mouse, and starting a whole new drag.
I was honestly on the fence about whether to file this as a feature request or a bug report, because while I can understand how "Grab And Move dynamically responds to your mouse's relative location in the window during resizes!" sounds like a feature, in practice, the nature of how it determines which resize to perform winds up making it *more* complicated to perform a resize than just grabbing the edge in the traditional way was.
However, the solution to both of these problems is very simple: add an option for Grab And Move to **not** constantly re-determine which region of the window you're pulling on *during* ongoing resizes. Wherever your cursor is when you press down on the right-click will determine what type of resize to perform just as it does now, but then it just stays locked to *that* type of resize *regardless* of whether your cursor has since wound up in a different region mid-resize. I know that would make it harder to convert (for example) a right-only resize into a right-and-down resize, but I think the number of scenarios that it would *ameliorate* would be worth the tradeoff (and besides, that's why it would be merely an option). (And also, an "all resizes are diagonal" option, i.e. one that covers the window with four regions rather than 8, would reduce the need for converting a one-axis drag to a two-axis drag anyway, meaning the only tradeoff left would be if someone wanted to strictly change one axis. Which again, would be fine, if these were just options.)
### Scenario when this would be used?
When resizing a window quickly, especially when making it smaller, as part of exposing another window underneath or ensuring that a window's contents all fit on a single screen. Typically I want to just quickly yank a window down to a manageable size in order to expose more windows, as the first step of moving those windows around into a better arrangement on the desktop. Grab And Move's resize feature seemed perfect for this, except that in practice, half the time I would wind up with a window that's LARGER rather than smaller, sometimes the axis that I needed to change having barely changed at all.
### Supporting information
_No response_
Contributor guide
Research direction
Start by locating the Grab And Move resize implementation and its settings or options entry point. Read how the initial resize region is selected and how it is updated during a drag; done means an option can preserve that initial resize mode throughout the gesture, including the corner and edge scenarios described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- desktop, operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100