diff --git a/libs/simple-button.lua b/libs/simple-button.lua index d16a2c1..06ffb79 100644 --- a/libs/simple-button.lua +++ b/libs/simple-button.lua @@ -112,19 +112,18 @@ function button:isHovering(x,y) end end ---Trigger press action, only when ``self._hovering`` is true ----@param isTouch? boolean Button just released by mouse? -function button:press(x, y, isTouch) +function button:press(x, y) if self:isHovering(x, y) and not self._pressed then - self.codeWhenPressed() self._pressed = true + self.codeWhenPressed() end 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) +function button:release(x, y) + error(self._pressed and "okay") if self:isHovering(x, y) and self._pressed then - self.codeWhenReleased() self._pressed = false + self.codeWhenReleased() end end