From 3e49470d3da4ec5b0d8b53ee16ec9a8139f81c0b Mon Sep 17 00:00:00 2001 From: Paul Liverman III Date: Sun, 17 Apr 2016 20:58:45 -0700 Subject: [PATCH] fixed order of click handling --- demo/pop/init.lua | 4 ++-- lib/pop/init.lua | 4 ++-- src/pop/init.moon | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/demo/pop/init.lua b/demo/pop/init.lua index 04d7b3c..6782a89 100644 --- a/demo/pop/init.lua +++ b/demo/pop/init.lua @@ -146,7 +146,7 @@ pop.mousepressed = function(x, y, button, element) pop.focused = element pop.events[button] = element else - for i = 1, #element.child do + for i = #element.child, 1, -1 do handled = pop.mousepressed(x, y, button, element.child[i]) if handled then break @@ -173,7 +173,7 @@ pop.mousereleased = function(x, y, button, element) if clickedHandled or mousereleasedHandled then return clickedHandled, mousereleasedHandled else - 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 break diff --git a/lib/pop/init.lua b/lib/pop/init.lua index 04d7b3c..6782a89 100644 --- a/lib/pop/init.lua +++ b/lib/pop/init.lua @@ -146,7 +146,7 @@ pop.mousepressed = function(x, y, button, element) pop.focused = element pop.events[button] = element else - for i = 1, #element.child do + for i = #element.child, 1, -1 do handled = pop.mousepressed(x, y, button, element.child[i]) if handled then break @@ -173,7 +173,7 @@ pop.mousereleased = function(x, y, button, element) if clickedHandled or mousereleasedHandled then return clickedHandled, mousereleasedHandled else - 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 break diff --git a/src/pop/init.moon b/src/pop/init.moon index 19517ce..eb820c9 100644 --- a/src/pop/init.moon +++ b/src/pop/init.moon @@ -122,7 +122,7 @@ pop.mousepressed = (x, y, button, element) -> pop.focused = element pop.events[button] = element else - for i = 1, #element.child + for i = #element.child, 1, -1 handled = pop.mousepressed x, y, button, element.child[i] if handled break @@ -146,7 +146,7 @@ pop.mousereleased = (x, y, button, element) -> if clickedHandled or mousereleasedHandled return clickedHandled, mousereleasedHandled else - 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 break