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
|
||||
if not (handled) then
|
||||
if element.mousepressed then
|
||||
do
|
||||
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
|
||||
return handled
|
||||
end
|
||||
pop.mousereleased = function(x, y, button, element)
|
||||
@ -270,7 +268,6 @@ pop.mousereleased = function(x, y, button, element)
|
||||
return clickedHandled, mousereleasedHandled
|
||||
end
|
||||
end
|
||||
if not (clickedHandled or mousereleasedHandled) then
|
||||
if element.clicked then
|
||||
clickedHandled = element:clicked(x - element.data.x, y - element.data.y, button)
|
||||
end
|
||||
@ -281,7 +278,6 @@ pop.mousereleased = function(x, y, button, element)
|
||||
pop.focused = element
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
log("mousereleased", x, y, button)
|
||||
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]
|
||||
return handled
|
||||
|
||||
-- if a child hasn't handled it yet (note: this check doesn't seem neccessary)
|
||||
unless handled
|
||||
-- if we can handle it, try to handle it, and set pop.focused
|
||||
-- if a child hasn't handled it yet, try to handle it, and set pop.focused
|
||||
if element.mousepressed
|
||||
if handled = element\mousepressed x - element.data.x, y - element.data.y, button
|
||||
pop.focused = element
|
||||
@ -356,8 +354,7 @@ pop.mousereleased = (x, y, button, element) ->
|
||||
if clickedHandled or mousereleasedHandled
|
||||
return clickedHandled, mousereleasedHandled
|
||||
|
||||
-- if that doesn't work, we try to handle it ourselves (note: again, this check seems unneccessary)
|
||||
unless clickedHandled or mousereleasedHandled
|
||||
-- if that doesn't work, we try to handle it ourselves
|
||||
if element.clicked
|
||||
clickedHandled = element\clicked x - element.data.x, y - element.data.y, button
|
||||
if element.mousereleased
|
||||
|
Loading…
Reference in New Issue
Block a user