Skip to content

Commit

Permalink
Hold control to resize when you're in the move-selected tool
Browse files Browse the repository at this point in the history
  • Loading branch information
jaburns committed Mar 27, 2020
1 parent 2c2db29 commit be2a139
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions Pinta.Tools/Tools/BaseTransformTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public abstract class BaseTransformTool : BaseTool
private bool is_dragging = false;
private bool is_rotating = false;
private bool rotateBySteps = false;
private bool is_scaling = false;
#endregion

#region Constructor
Expand Down Expand Up @@ -115,12 +116,18 @@ protected override void OnMouseMove (object o,

transform.InitIdentity ();

if (is_rotating)
if (is_scaling)
{
if (rotateBySteps)
angle = Utility.GetNearestStepAngle (angle, rotate_steps);
transform.Translate(center.X, center.Y);
transform.Scale( (cx1 + dx) / cx1, (cy1 + dy) / cy1 );
transform.Translate(-center.X, -center.Y);
}
else if (is_rotating)
{
if (rotateBySteps)
angle = Utility.GetNearestStepAngle (angle, rotate_steps);

transform.Translate(center.X, center.Y);
transform.Translate(center.X, center.Y);
transform.Rotate(-angle);
transform.Translate(-center.X, -center.Y);
}
Expand All @@ -143,11 +150,13 @@ protected override void OnMouseUp (Gtk.DrawingArea canvas, Gtk.ButtonReleaseEven
protected override void OnKeyDown (Gtk.DrawingArea canvas, Gtk.KeyPressEventArgs args)
{
rotateBySteps = (args.Event.Key == Gdk.Key.Shift_L);
is_scaling = (args.Event.Key == Gdk.Key.Control_L);
}

protected override void OnKeyUp (Gtk.DrawingArea canvas, Gtk.KeyReleaseEventArgs args)
{
rotateBySteps = false;
is_scaling = false;
}
#endregion
}
Expand Down

0 comments on commit be2a139

Please sign in to comment.