The resizing and movement mechanics for the avatar crop can be finicky, because:
- The crop resets to the last valid crop when you drag out of range, so that a somewhat quick drag does not go to the edge.
- A corner drag only works in one direction, as the use of eval_radial_line is not correct.
- A side drag acts the same as a corner drag.
- A slow drag won't move the crop, especially if the widget is larger.
All these issues are fixed with this partial rewrite of the resize and movement logic:
- A drag out of range will result in a size that is guaranteed to touch the edge, making a crop to the edge much easier.
- Instead of fixing eval_radial_line, we just "bind" one side to the pointer position, making both directions act the same for a corner drag.
- A side drag now scales around the center for the orthogonal side.
- Rounding errors in calculating the previous delta are prevented.
Note that the behavior is now similar to how for example a textbox is resized in LibreOffice Writer (while holding shift). I am sure there are more examples of similar mechanics.
The videos demonstrate the issues and fixes (on top of !1824 (merged) to make it easier to see).
This problem was also shown in #2514 (closed).