Modifying stamp rotation process: easier 0 degree
Rotation off of zero (0) degrees only occurs when dragging outside the bounding box (rectangle around the width/height) of the stamp. No longer warping mouse to the right of the stamp, to cause it to default to zero degrees. (The mouse being at the center of the stamp now causes this, per the above change.) Motivation - Placing stamps on mobile (touchscreen) was difficult and non-intuitive. Now, you can at least double-tap the same spot on the screen to position, and then place (without rotation) the stamp. It's still not perfect, and I think a UI option to enable/disable stamp rotation (leaving it off by default) is needed.
This commit is contained in:
parent
7af85524d7
commit
6fd0517f1e
1 changed files with 19 additions and 12 deletions
|
|
@ -22,7 +22,7 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
(See COPYING.txt)
|
||||
|
||||
June 14, 2002 - February 16, 2023
|
||||
June 14, 2002 - February 18, 2023
|
||||
*/
|
||||
|
||||
#include "platform.h"
|
||||
|
|
@ -2196,6 +2196,7 @@ static void free_surface_array(SDL_Surface * surface_array[], int count);
|
|||
static void do_shape(int sx, int sy, int nx, int ny, int rotn, int use_brush);
|
||||
static int shape_rotation(int ctr_x, int ctr_y, int ox, int oy);
|
||||
static int brush_rotation(int ctr_x, int ctr_y, int ox, int oy);
|
||||
static int stamp_rotation(int ctr_x, int ctr_y, int ox, int oy);
|
||||
static int do_save(int tool, int dont_show_success_results, int autosave);
|
||||
static int do_png_save(FILE * fi, const char *const fname, SDL_Surface * surf,
|
||||
int embed);
|
||||
|
|
@ -6224,9 +6225,9 @@ static void mainloop(void)
|
|||
{
|
||||
if (!no_stamp_rotation)
|
||||
{
|
||||
int mouse_warp_x;
|
||||
|
||||
/* Going through stamp rotation step, first */
|
||||
#if 0
|
||||
int mouse_warp_x;
|
||||
|
||||
/* Warp mouse to the far right of the stamp,
|
||||
where we'll start at 0-degrees of rotation
|
||||
|
|
@ -6235,7 +6236,8 @@ static void mainloop(void)
|
|||
if (mouse_warp_x >= WINDOW_WIDTH - r_ttoolopt.w)
|
||||
mouse_warp_x = WINDOW_WIDTH - r_ttoolopt.w - 1;
|
||||
|
||||
SDL_WarpMouse(mouse_warp_x, old_y);
|
||||
SDL_WarpMouse(mouse_warp_x, old_y); // FIXME 2023-02-18
|
||||
#endif
|
||||
do_setcursor(cursor_rotate);
|
||||
|
||||
stamp_tool_mode = STAMP_TOOL_MODE_ROTATE;
|
||||
|
|
@ -6273,7 +6275,7 @@ static void mainloop(void)
|
|||
rec_undo_buffer();
|
||||
playsound(screen, 1, SND_STAMP, 1, stamp_place_x, SNDDIST_NEAR);
|
||||
int stamp_angle_rotation =
|
||||
360 - brush_rotation(stamp_place_x, stamp_place_y, old_x,
|
||||
360 - stamp_rotation(stamp_place_x, stamp_place_y, old_x,
|
||||
old_y);
|
||||
|
||||
stamp_draw(stamp_place_x, stamp_place_y, stamp_angle_rotation);
|
||||
|
|
@ -6339,7 +6341,7 @@ static void mainloop(void)
|
|||
shape_current_y) * (shape_start_y -
|
||||
shape_current_y));
|
||||
|
||||
SDL_WarpMouse(shape_current_x + r_ttools.w, shape_start_y);
|
||||
SDL_WarpMouse(shape_current_x + r_ttools.w, shape_start_y); // FIXME 2023-02-18
|
||||
do_setcursor(cursor_rotate);
|
||||
|
||||
|
||||
|
|
@ -6967,8 +6969,9 @@ static void mainloop(void)
|
|||
if (stamp_tool_mode == STAMP_TOOL_MODE_ROTATE)
|
||||
{
|
||||
stamp_xor(stamp_place_x, stamp_place_y);
|
||||
|
||||
update_stamp_xor((360 -
|
||||
brush_rotation(stamp_place_x, stamp_place_y,
|
||||
stamp_rotation(stamp_place_x, stamp_place_y,
|
||||
new_x, new_y)) % 360);
|
||||
stamp_xor(stamp_place_x, stamp_place_y);
|
||||
|
||||
|
|
@ -16331,14 +16334,18 @@ static int shape_rotation(int ctr_x, int ctr_y, int ox, int oy)
|
|||
/**
|
||||
* FIXME
|
||||
*/
|
||||
/* What angle is the mouse away from a brush drag or line draw? */
|
||||
/* What angle (degrees) is the mouse away from a brush drag, line draw, or stamp placement? */
|
||||
static int brush_rotation(int ctr_x, int ctr_y, int ox, int oy)
|
||||
{
|
||||
int deg;
|
||||
return (atan2(oy - ctr_y, ox - ctr_x) * 180 / M_PI);
|
||||
}
|
||||
|
||||
deg = (atan2(oy - ctr_y, ox - ctr_x) * 180 / M_PI);
|
||||
|
||||
return (deg);
|
||||
/* What angle (degrees) is the mouse away from a stamp placement (keep at zero if within stamp's bounding box!) */
|
||||
static int stamp_rotation(int ctr_x, int ctr_y, int ox, int oy)
|
||||
{
|
||||
if (abs(ctr_x - ox) <= CUR_STAMP_W / 2 && abs(ctr_y - oy) <= CUR_STAMP_H / 2)
|
||||
return (0);
|
||||
return brush_rotation(ctr_x, ctr_y, ox, oy);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue