mirror of
https://github.com/TangentFoxy/Pop.Box.git
synced 2024-12-15 12:44:20 +00:00
removed unneeded checks in mouse handling
This commit is contained in:
parent
65f9715f99
commit
3fb4b15241
4
init.lua
4
init.lua
@ -246,7 +246,6 @@ pop.mousepressed = function(x, y, button, element)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not (handled) then
|
|
||||||
if element.mousepressed then
|
if element.mousepressed then
|
||||||
do
|
do
|
||||||
handled = element:mousepressed(x - element.data.x, y - element.data.y, button)
|
handled = element:mousepressed(x - element.data.x, y - element.data.y, button)
|
||||||
@ -256,7 +255,6 @@ pop.mousepressed = function(x, y, button, element)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
return handled
|
return handled
|
||||||
end
|
end
|
||||||
pop.mousereleased = function(x, y, button, element)
|
pop.mousereleased = function(x, y, button, element)
|
||||||
@ -270,7 +268,6 @@ pop.mousereleased = function(x, y, button, element)
|
|||||||
return clickedHandled, mousereleasedHandled
|
return clickedHandled, mousereleasedHandled
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not (clickedHandled or mousereleasedHandled) then
|
|
||||||
if element.clicked then
|
if element.clicked then
|
||||||
clickedHandled = element:clicked(x - element.data.x, y - element.data.y, button)
|
clickedHandled = element:clicked(x - element.data.x, y - element.data.y, button)
|
||||||
end
|
end
|
||||||
@ -281,7 +278,6 @@ pop.mousereleased = function(x, y, button, element)
|
|||||||
pop.focused = element
|
pop.focused = element
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
else
|
else
|
||||||
log("mousereleased", x, y, button)
|
log("mousereleased", x, y, button)
|
||||||
pop.mousereleased(x, y, button, pop.screen)
|
pop.mousereleased(x, y, button, pop.screen)
|
||||||
|
@ -318,9 +318,7 @@ pop.mousepressed = (x, y, button, element) ->
|
|||||||
if handled = pop.mousepressed x, y, button, element.child[i]
|
if handled = pop.mousepressed x, y, button, element.child[i]
|
||||||
return handled
|
return handled
|
||||||
|
|
||||||
-- if a child hasn't handled it yet (note: this check doesn't seem neccessary)
|
-- if a child hasn't handled it yet, try to handle it, and set pop.focused
|
||||||
unless handled
|
|
||||||
-- if we can handle it, try to handle it, and set pop.focused
|
|
||||||
if element.mousepressed
|
if element.mousepressed
|
||||||
if handled = element\mousepressed x - element.data.x, y - element.data.y, button
|
if handled = element\mousepressed x - element.data.x, y - element.data.y, button
|
||||||
pop.focused = element
|
pop.focused = element
|
||||||
@ -356,8 +354,7 @@ pop.mousereleased = (x, y, button, element) ->
|
|||||||
if clickedHandled or mousereleasedHandled
|
if clickedHandled or mousereleasedHandled
|
||||||
return clickedHandled, mousereleasedHandled
|
return clickedHandled, mousereleasedHandled
|
||||||
|
|
||||||
-- if that doesn't work, we try to handle it ourselves (note: again, this check seems unneccessary)
|
-- if that doesn't work, we try to handle it ourselves
|
||||||
unless clickedHandled or mousereleasedHandled
|
|
||||||
if element.clicked
|
if element.clicked
|
||||||
clickedHandled = element\clicked x - element.data.x, y - element.data.y, button
|
clickedHandled = element\clicked x - element.data.x, y - element.data.y, button
|
||||||
if element.mousereleased
|
if element.mousereleased
|
||||||
|
Loading…
Reference in New Issue
Block a user