From 765ad56165f87cbb77370edc0e43e82e9d50dbc0 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:17:03 +0700 Subject: [PATCH] TEST --- libs/simple-button.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libs/simple-button.lua b/libs/simple-button.lua index 226ccf6..14729d4 100644 --- a/libs/simple-button.lua +++ b/libs/simple-button.lua @@ -115,7 +115,12 @@ end ---Trigger press action, only when ``self._hovering`` is true ---@param isTouch? boolean Button just released by mouse? function button:press(x, y, isTouch) - local hovering = isTouch and self:isHovering(x, y) or self._hovering + local hovering + if isTouch then + hovering = self:isHovering(x, y) + else + hovering = self._hovering + end if hovering and not self._pressed then self.codeWhenPressed() @@ -125,8 +130,12 @@ end ---Trigger release action, don't need ``self._hovering`` to ``true`` ---@param isTouch? boolean Button just released by mouse? function button:release(x, y, isTouch) - error() - local hovering = isTouch and self:isHovering(x, y) or self._hovering + local hovering + if isTouch then + hovering = self:isHovering(x, y) + else + hovering = self._hovering + end if hovering and self._pressed then self.codeWhenReleased()