From 93f05af10d3caeae942a5e6715a6a40d4b583856 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Fri, 28 Aug 2020 21:51:51 -0700 Subject: [PATCH] Ensure easy rotation of corner-stretched shapes If corner-stretched shape is pulled to the left, make sure the rotation step works properly. --- src/tuxpaint.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index c604137df..dcef231c0 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -2212,6 +2212,8 @@ enum SHAPE_TOOL_MODE_DONE }; +int shape_reverse; + int brushflag, xnew, ynew, eraflag, lineflag, magicflag, keybd_flag, keybd_position, keyglobal, initial_y, gen_key_flag, ide, activeflag, old_x, old_y; @@ -5359,6 +5361,8 @@ static void mainloop(void) do_shape(shape_start_x, shape_start_y, new_x, new_y, 0, 0); + shape_reverse = (new_x < shape_start_x); + /* FIXME: Fix update shape function! */ @@ -13256,9 +13260,12 @@ static int shape_rotation(int ctr_x, int ctr_y, int ox, int oy) { int deg; - deg = (atan2(oy - ctr_y, ox - ctr_x) * 180 / M_PI); + if (shape_reverse && shape_mode == SHAPEMODE_CORNER) { + deg = (deg + 180) % 360; + } + if (shape_radius < 50) deg = ((deg - 15) / 30) * 30; else if (shape_radius < 100)