core/menusystem: only count click if menu is currently active

This commit is contained in:
Kazhnuz 2019-02-11 22:39:18 +01:00
parent 205de52345
commit 28beee9c41

View file

@ -69,12 +69,14 @@ end
function MenuSystem:mousepressed( x, y, button, istouch ) function MenuSystem:mousepressed( x, y, button, istouch )
for k,v in pairs(self.menus) do for k,v in pairs(self.menus) do
if (x > v.x) and (x < v.x + v.w) and (y > v.y) and (y < v.y + v.h) then if v.isActive then
v:mousepressed(x - v.x, y - v.y, button, istouch ) if (x > v.x) and (x < v.x + v.w) and (y > v.y) and (y < v.y + v.h) then
for j,u in ipairs(self.menus) do v:mousepressed(x - v.x, y - v.y, button, istouch )
u.focus = false for j,u in ipairs(self.menus) do
u.focus = false
end
v.focus = true
end end
v.focus = true
end end
end end
end end