removed unneeded checks in mouse handling

This commit is contained in:
Paul Liverman III 2017-04-18 22:44:42 -07:00
parent 65f9715f99
commit 3fb4b15241
2 changed files with 31 additions and 38 deletions

View File

@ -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)

View File

@ -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