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:
@@ -117,17 +117,13 @@ 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, isMouse)
|
function button:release(x, y, isMouse)
|
||||||
if self:isHovering(x, y) then
|
if self:isHovering(x, y) and self._pressed then
|
||||||
if self._pressed then
|
self.codeWhenReleased()
|
||||||
self.codeWhenReleased()
|
self._pressed = false
|
||||||
self._pressed = false
|
if isMouse then
|
||||||
if isMouse then
|
self._hovering = self:isHovering(x, y)
|
||||||
self._hovering = self:isHovering(x, y)
|
else
|
||||||
error("mouse")
|
self._hovering = false
|
||||||
else
|
|
||||||
self._hovering = false
|
|
||||||
error("touch")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
2
main.lua
2
main.lua
@@ -120,10 +120,12 @@ function love.draw()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function love.mousepressed(x, y, b, isTouch, presses)
|
function love.mousepressed(x, y, b, isTouch, presses)
|
||||||
|
if isTouch then return end
|
||||||
local x,y=GLOBAL_TRANSFORM:inverseTransformPoint(x,y)
|
local x,y=GLOBAL_TRANSFORM:inverseTransformPoint(x,y)
|
||||||
SCENE:onInputPress{type = "mouse", x = x, y = y, button = b, presses = presses}
|
SCENE:onInputPress{type = "mouse", x = x, y = y, button = b, presses = presses}
|
||||||
end
|
end
|
||||||
function love.mousereleased(x, y, b, isTouch, presses)
|
function love.mousereleased(x, y, b, isTouch, presses)
|
||||||
|
if isTouch then return end
|
||||||
local x,y=GLOBAL_TRANSFORM:inverseTransformPoint(x,y)
|
local x,y=GLOBAL_TRANSFORM:inverseTransformPoint(x,y)
|
||||||
SCENE:onInputRelease{type = "mouse", x = x, y = y, button = b, presses = presses}
|
SCENE:onInputRelease{type = "mouse", x = x, y = y, button = b, presses = presses}
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user