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