bugfix: propagate mouse press if any button would
Before this commit I was propagating press events only if _all_ buttons would.
This commit is contained in:
parent
ce31b74b10
commit
9c72ff1bb4
10
button.lua
10
button.lua
|
@ -23,15 +23,17 @@ function mouse_press_consumed_by_any_button_handler(State, x, y, mouse_button)
|
||||||
if State.button_handlers == nil then
|
if State.button_handlers == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local result = false
|
local button_pressed = false
|
||||||
|
local consume_press = true
|
||||||
for _,ev in ipairs(State.button_handlers) do
|
for _,ev in ipairs(State.button_handlers) do
|
||||||
if x>ev.x and x<ev.x+ev.w and y>ev.y and y<ev.y+ev.h then
|
if x>ev.x and x<ev.x+ev.w and y>ev.y and y<ev.y+ev.h then
|
||||||
if ev.onpress1 and mouse_button == 1 then
|
if ev.onpress1 and mouse_button == 1 then
|
||||||
if not ev.onpress1() then
|
button_pressed = true
|
||||||
result = true
|
if ev.onpress1() then
|
||||||
|
consume_press = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return result
|
return button_pressed and consume_press
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue