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:
@@ -116,14 +116,16 @@ function button:press(x, y)
|
||||
end
|
||||
---Trigger release action, don't need ``self._hovering`` to ``true``
|
||||
---@param isMouse? boolean Button just released by mouse?
|
||||
function button:release(x, y, isTouch)
|
||||
if self:isHovering(x, y) and self._pressed then
|
||||
self.codeWhenReleased()
|
||||
self._pressed = false
|
||||
if isTouch then
|
||||
self._hovering = false
|
||||
else
|
||||
function button:release(x, y, isMouse)
|
||||
if self:isHovering(x, y) then
|
||||
if self._pressed then
|
||||
self.codeWhenReleased()
|
||||
self._pressed = false
|
||||
end
|
||||
if isMouse then
|
||||
self:isHovering(x, y)
|
||||
elseif self._hovering then
|
||||
self._hovering = false
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -226,7 +228,7 @@ end
|
||||
---Calling BUTTON.press will trigger this, but you can call it when moving mouse so button can be highlighted when being hovered
|
||||
---@param list table<BUTTON.button>
|
||||
---@param x number # Mouse position
|
||||
---@param y nunber # Mouse position
|
||||
---@param y number # Mouse position
|
||||
function BUTTON.checkHovering(list, x, y)
|
||||
for _, v in pairs(list) do v:isHovering(x, y) end
|
||||
end
|
||||
@@ -234,7 +236,7 @@ end
|
||||
--- Trigger the press action, only if ``button._hovering == true``
|
||||
---@param list table<BUTTON.button>
|
||||
---@param x number # Mouse position
|
||||
---@param y nunber # Mouse position
|
||||
---@param y number # Mouse position
|
||||
function BUTTON.press(list, x, y)
|
||||
for _, v in pairs(list) do v:press(x, y) end
|
||||
end
|
||||
@@ -242,10 +244,10 @@ end
|
||||
---Trigger the release action
|
||||
---@param list table<BUTTON.button>
|
||||
---@param x number # Mouse position
|
||||
---@param y nunber # Mouse position
|
||||
---@param y number # Mouse position
|
||||
---@param isMouse? boolean # Is mouse just released a button?
|
||||
function BUTTON.release(list, x, y, isTouch)
|
||||
for _, v in pairs(list) do v:release(x, y, isTouch) end
|
||||
function BUTTON.release(list, x, y, isMouse)
|
||||
for _, v in pairs(list) do v:release(x, y, isMouse) end
|
||||
end
|
||||
|
||||
return BUTTON
|
||||
@@ -83,9 +83,9 @@ end
|
||||
---@param e SCENE_onInput
|
||||
function TouchConfigScene:onInputRelease(e)
|
||||
if e.type == "mouse" then
|
||||
BUTTON.release(buttonList, e.x, e.y)
|
||||
elseif e.type == "touch" then
|
||||
BUTTON.release(buttonList, e.x, e.y, true)
|
||||
elseif e.type == "touch" then
|
||||
BUTTON.release(buttonList, e.x, e.y)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user