From 0aab8c8d74d36647da688cb2119d1123dfab3bab Mon Sep 17 00:00:00 2001 From: "Squishy (C6H12O6+NaCl+H2O)" <106439598+SweetSea-ButImNotSweet@users.noreply.github.com> Date: Tue, 21 May 2024 23:26:29 +0700 Subject: [PATCH] TEST --- libs/simple-button.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libs/simple-button.lua b/libs/simple-button.lua index f8e4ea5..8c10ab9 100644 --- a/libs/simple-button.lua +++ b/libs/simple-button.lua @@ -97,20 +97,19 @@ function button:draw() love.graphics.setColor(self.borderColor) love.graphics.rectangle('line', self.x, self.y, self.w, self.h, self.r) end ----Check if current position is hovering the button, if yes, set ``self._hovering`` to true and return true +---Check if current position is hovering the button, if it is, return true function button:isHovering(x,y) - if not y then self._hovering = false; return false end + if not y then return false end if x >= self.x and y >= self.y and x <= self.x + self.w and y <= self.y + self.h then - self._hovering = true + return true else - self._hovering = false + return false end - return self._hovering end ---Trigger press action, only when ``self._hovering`` is true ---@param isTouch? boolean Button just released by mouse?