From c0a60d712868e0eded111913995caa97091a90a5 Mon Sep 17 00:00:00 2001 From: Tylas <61948311+Tylas11@users.noreply.github.com> Date: Sat, 9 May 2020 12:58:58 +0200 Subject: [PATCH 1/2] fixed images.hover --- addons/libs/images.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/libs/images.lua b/addons/libs/images.lua index e85d707b4..f36afa025 100644 --- a/addons/libs/images.lua +++ b/addons/libs/images.lua @@ -351,12 +351,12 @@ function images.hover(t, x, y) local pos_x, pos_y = t:pos() local off_x, off_y = t:get_extents() - -- print(pos_x, pos_y, off_x, off_y) + -- print(x, y, pos_x, pos_y, off_x, off_y) - return (pos_x <= x and x <= pos_x + off_x - or pos_x >= x and x >= pos_x + off_x) - and (pos_y <= y and y <= pos_y + off_y - or pos_y >= y and y >= pos_y + off_y) + return (pos_x <= x and x <= off_x + or pos_x >= x and x >= off_x) + and (pos_y <= y and y <= off_y + or pos_y >= y and y >= off_y) end function images.destroy(t) From 87eedcabe843946c1b6aa652e949c489c76cc385 Mon Sep 17 00:00:00 2001 From: Tylas <61948311+Tylas11@users.noreply.github.com> Date: Sat, 9 May 2020 13:59:39 +0200 Subject: [PATCH 2/2] renamed local variables in images.hover --- addons/libs/images.lua | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/addons/libs/images.lua b/addons/libs/images.lua index f36afa025..b54021025 100644 --- a/addons/libs/images.lua +++ b/addons/libs/images.lua @@ -348,15 +348,13 @@ function images.hover(t, x, y) return false end - local pos_x, pos_y = t:pos() - local off_x, off_y = t:get_extents() - - -- print(x, y, pos_x, pos_y, off_x, off_y) + local start_pos_x, start_pos_y = t:pos() + local end_pos_x, end_pos_y = t:get_extents() - return (pos_x <= x and x <= off_x - or pos_x >= x and x >= off_x) - and (pos_y <= y and y <= off_y - or pos_y >= y and y >= off_y) + return (start_pos_x <= x and x <= end_pos_x + or start_pos_x >= x and x >= end_pos_x) + and (start_pos_y <= y and y <= end_pos_y + or start_pos_y >= y and y >= end_pos_y) end function images.destroy(t)