mirror of
https://gitea.com/SweetSea-ButImNotSweet/tromi_mobile.git
synced 2025-01-08 17:33:09 +08:00
TEST
This commit is contained in:
@@ -115,29 +115,15 @@ end
|
|||||||
---Trigger press action, only when ``self._hovering`` is true
|
---Trigger press action, only when ``self._hovering`` is true
|
||||||
---@param isTouch? boolean Button just released by mouse?
|
---@param isTouch? boolean Button just released by mouse?
|
||||||
function button:press(x, y, isTouch)
|
function button:press(x, y, isTouch)
|
||||||
local hovering
|
if self:isHovering(x, y) and not self._pressed then
|
||||||
if isTouch then
|
self.codeWhenReleased()
|
||||||
hovering = self:isHovering(x, y)
|
|
||||||
else
|
|
||||||
hovering = self._hovering
|
|
||||||
end
|
|
||||||
|
|
||||||
if hovering and not self._pressed then
|
|
||||||
self.codeWhenPressed()
|
|
||||||
self._pressed = true
|
self._pressed = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
---Trigger release action, don't need ``self._hovering`` to ``true``
|
---Trigger release action, don't need ``self._hovering`` to ``true``
|
||||||
---@param isTouch? boolean Button just released by mouse?
|
---@param isTouch? boolean Button just released by mouse?
|
||||||
function button:release(x, y, isTouch)
|
function button:release(x, y, isTouch)
|
||||||
local hovering
|
if self:isHovering(x, y) and self._pressed then
|
||||||
if isTouch then
|
|
||||||
hovering = self:isHovering(x, y)
|
|
||||||
else
|
|
||||||
hovering = self._hovering
|
|
||||||
end
|
|
||||||
|
|
||||||
if hovering and self._pressed then
|
|
||||||
self.codeWhenReleased()
|
self.codeWhenReleased()
|
||||||
self._pressed = false
|
self._pressed = false
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user