From 98ae5fc5e9274fea99a2ed8873b78fc2110ce3ce Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 22 Apr 2019 13:08:40 +0200 Subject: [PATCH] added forcing pointer-style global animations to stay inside window area --- src/anim.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/anim.c b/src/anim.c index d226d5cd..8256ce7f 100644 --- a/src/anim.c +++ b/src/anim.c @@ -863,8 +863,11 @@ static boolean SetGlobalAnimPart_Viewport(struct GlobalAnimPartControlInfo *part } else if (part->control_info.class == get_hash_from_key("pointer")) { - viewport_x = gfx.mouse_x + part->control_info.x; - viewport_y = gfx.mouse_y + part->control_info.y; + int mx = MIN(MAX(0, gfx.mouse_x), WIN_XSIZE - 1); + int my = MIN(MAX(0, gfx.mouse_y), WIN_YSIZE - 1); + + viewport_x = mx + part->control_info.x; + viewport_y = my + part->control_info.y; viewport_width = part->graphic_info.width; viewport_height = part->graphic_info.height; -- 2.34.1