Lock aspect ratio in the scale tool when alt is held down
This commit is contained in:
parent
b254a6823b
commit
e57035c832
1 changed files with 6 additions and 0 deletions
|
@ -98,6 +98,12 @@ void VisualToolScale::UpdateHold() {
|
||||||
Vector2D delta = (mouse_pos - drag_start) * Vector2D(1, -1);
|
Vector2D delta = (mouse_pos - drag_start) * Vector2D(1, -1);
|
||||||
if (shift_down)
|
if (shift_down)
|
||||||
delta = delta.SingleAxis();
|
delta = delta.SingleAxis();
|
||||||
|
if (alt_down) {
|
||||||
|
if (abs(delta.X()) > abs(delta.Y()))
|
||||||
|
delta = Vector2D(delta.X(), delta.X() * (initial_scale.Y() / initial_scale.X()));
|
||||||
|
else
|
||||||
|
delta = Vector2D(delta.Y() * (initial_scale.X() / initial_scale.Y()), delta.Y());
|
||||||
|
}
|
||||||
|
|
||||||
scale = Vector2D(0, 0).Max(delta * 1.25f + initial_scale);
|
scale = Vector2D(0, 0).Max(delta * 1.25f + initial_scale);
|
||||||
if (ctrl_down)
|
if (ctrl_down)
|
||||||
|
|
Loading…
Reference in a new issue