diff --git a/docs/classes/element.html b/docs/classes/element.html index 878a387..893211b 100644 --- a/docs/classes/element.html +++ b/docs/classes/element.html @@ -426,7 +426,7 @@
generated by LDoc 1.4.3 -Last updated 2017-04-11 01:22:59 +Last updated 2017-04-11 08:56:04
diff --git a/docs/classes/window.html b/docs/classes/window.html index eff8804..cfead2c 100644 --- a/docs/classes/window.html +++ b/docs/classes/window.html @@ -144,7 +144,7 @@
generated by LDoc 1.4.3 -Last updated 2017-04-11 01:22:59 +Last updated 2017-04-11 08:56:04
diff --git a/docs/index.html b/docs/index.html index 206501d..09d85af 100644 --- a/docs/index.html +++ b/docs/index.html @@ -84,7 +84,7 @@
generated by LDoc 1.4.3 -Last updated 2017-04-11 01:22:59 +Last updated 2017-04-11 08:56:04
diff --git a/docs/modules/Element.html b/docs/modules/Element.html index e92b3d8..d76d2bd 100644 --- a/docs/modules/Element.html +++ b/docs/modules/Element.html @@ -491,7 +491,7 @@
generated by LDoc 1.4.3 -Last updated 2017-04-11 01:22:59 +Last updated 2017-04-11 08:56:04
diff --git a/docs/modules/main.html b/docs/modules/main.html index f713f86..1ba063f 100644 --- a/docs/modules/main.html +++ b/docs/modules/main.html @@ -105,7 +105,7 @@
generated by LDoc 1.4.3 -Last updated 2017-04-11 01:22:59 +Last updated 2017-04-11 08:56:04
diff --git a/docs/modules/pop.html b/docs/modules/pop.html index 940b6d3..7aa21c1 100644 --- a/docs/modules/pop.html +++ b/docs/modules/pop.html @@ -723,7 +723,7 @@ table.insert element.parent, element.parent\removeChild(element),
generated by LDoc 1.4.3 -Last updated 2017-04-11 01:22:59 +Last updated 2017-04-11 08:56:04
diff --git a/docs/modules/util.html b/docs/modules/util.html index 6bc07da..2afb985 100644 --- a/docs/modules/util.html +++ b/docs/modules/util.html @@ -126,7 +126,7 @@
generated by LDoc 1.4.3 -Last updated 2017-04-11 01:22:59 +Last updated 2017-04-11 08:56:04
diff --git a/init.lua b/init.lua index a384d25..2fdb791 100644 --- a/init.lua +++ b/init.lua @@ -215,7 +215,7 @@ pop.mousemoved = function(x, y, dx, dy, element) end if element.data.draw and (x >= element.data.x) and (x <= element.data.x + element.data.w) and (y >= element.data.y) and (y <= element.data.y + element.data.h) then pop.hovered = element - for i = 1, #element.child do + for i = #element.child, 1, -1 do pop.mousemoved(x, y, dx, dy, element.child[i]) end end @@ -231,7 +231,7 @@ pop.mousepressed = function(x, y, button, element) end local handled = false if element.data.draw and (x >= element.data.x) and (x <= element.data.x + element.data.w) and (y >= element.data.y) and (y <= element.data.y + element.data.h) then - for i = 1, #element.child do + for i = #element.child, 1, -1 do do handled = pop.mousepressed(x, y, button, element.child[i]) if handled then @@ -257,7 +257,7 @@ pop.mousereleased = function(x, y, button, element) local mousereleasedHandled = false if element then if element.data.draw and (x >= element.data.x) and (x <= element.data.x + element.data.w) and (y >= element.data.y) and (y <= element.data.y + element.data.h) then - for i = 1, #element.child do + for i = #element.child, 1, -1 do clickedHandled, mousereleasedHandled = pop.mousereleased(x, y, button, element.child[i]) if clickedHandled or mousereleasedHandled then return clickedHandled, mousereleasedHandled diff --git a/init.moon b/init.moon index 2ab959a..d03ff64 100644 --- a/init.moon +++ b/init.moon @@ -271,7 +271,7 @@ pop.mousemoved = (x, y, dx, dy, element=pop.screen) -> -- okay, we're over this element for sure, but let's check its children pop.hovered = element -- check in reverse order, it will set pop.hovered to any that match - for i = 1, #element.child + for i = #element.child, 1, -1 pop.mousemoved x, y, dx, dy, element.child[i] --- @todo Implement a way for an element to attach itself to `love.mousemoved()` events? @@ -306,7 +306,7 @@ pop.mousepressed = (x, y, button, element) -> -- if it is inside the current element.. if element.data.draw and (x >= element.data.x) and (x <= element.data.x + element.data.w) and (y >= element.data.y) and (y <= element.data.y + element.data.h) -- check its child elements in reverse order, returning if something handles it - for i = 1, #element.child + for i = #element.child, 1, -1 if handled = pop.mousepressed x, y, button, element.child[i] return handled @@ -343,7 +343,7 @@ pop.mousereleased = (x, y, button, element) -> if element if element.data.draw and (x >= element.data.x) and (x <= element.data.x + element.data.w) and (y >= element.data.y) and (y <= element.data.y + element.data.h) -- check its children in reverse for handling a clicked or mousereleased event - for i = 1, #element.child + for i = #element.child, 1, -1 clickedHandled, mousereleasedHandled = pop.mousereleased x, y, button, element.child[i] if clickedHandled or mousereleasedHandled return clickedHandled, mousereleasedHandled