Lock aspect ratio in the scale tool when alt is held down

This commit is contained in:
Thomas Goyne 2013-10-16 15:30:11 -07:00
parent b254a6823b
commit e57035c832
1 changed files with 6 additions and 0 deletions

View File

@ -98,6 +98,12 @@ void VisualToolScale::UpdateHold() {
Vector2D delta = (mouse_pos - drag_start) * Vector2D(1, -1);
if (shift_down)
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);
if (ctrl_down)