Stamps -> Rotation: Better mouse warping
Stamp width needed to be cut in half, since stamp's _center_ is at the click (old_x) position. Also, avoid warping outside of the canvas.
This commit is contained in:
parent
cc28f48f7e
commit
eaba5e94f4
2 changed files with 11 additions and 4 deletions
|
|
@ -7,7 +7,7 @@ Various contributors (see below, and AUTHORS.txt)
|
||||||
http://www.tuxpaint.org/
|
http://www.tuxpaint.org/
|
||||||
|
|
||||||
|
|
||||||
2022.September.10 (0.9.29)
|
2022.September.11 (0.9.29)
|
||||||
* Improvements to "Stamp" tool:
|
* Improvements to "Stamp" tool:
|
||||||
-----------------------------
|
-----------------------------
|
||||||
* Stamps may now be rotated.
|
* Stamps may now be rotated.
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
(See COPYING.txt)
|
(See COPYING.txt)
|
||||||
|
|
||||||
June 14, 2002 - September 5, 2022
|
June 14, 2002 - September 11, 2022
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
@ -5827,11 +5827,18 @@ static void mainloop(void)
|
||||||
{
|
{
|
||||||
if (!no_stamp_rotation)
|
if (!no_stamp_rotation)
|
||||||
{
|
{
|
||||||
|
int mouse_warp_x;
|
||||||
|
|
||||||
/* Going through stamp rotation step, first */
|
/* Going through stamp rotation step, first */
|
||||||
|
|
||||||
/* Warp mouse to the far right of the stamp,
|
/* Warp mouse to the far right of the stamp,
|
||||||
where we'll start at 0-degrees of rotation */
|
where we'll start at 0-degrees of rotation
|
||||||
SDL_WarpMouse(r_tools.w + old_x + active_stamp->w, old_y);
|
(keep it within the canvas, though!) */
|
||||||
|
mouse_warp_x = r_tools.w + old_x + (CUR_STAMP_W / 2);
|
||||||
|
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);
|
||||||
do_setcursor(cursor_rotate);
|
do_setcursor(cursor_rotate);
|
||||||
|
|
||||||
stamp_tool_mode = STAMP_TOOL_MODE_ROTATE;
|
stamp_tool_mode = STAMP_TOOL_MODE_ROTATE;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue