This commit is contained in:
Paul Liverman III 2017-04-11 01:23:10 -07:00
parent 958fa7c5dd
commit ceb4faabd4
9 changed files with 22 additions and 23 deletions

View File

@ -426,7 +426,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
<i style="float:right;">Last updated 2017-04-10 22:47:43 </i> <i style="float:right;">Last updated 2017-04-11 01:22:59 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -144,7 +144,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
<i style="float:right;">Last updated 2017-04-10 22:47:43 </i> <i style="float:right;">Last updated 2017-04-11 01:22:59 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -84,7 +84,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
<i style="float:right;">Last updated 2017-04-10 22:47:43 </i> <i style="float:right;">Last updated 2017-04-11 01:22:59 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -491,7 +491,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
<i style="float:right;">Last updated 2017-04-10 22:47:43 </i> <i style="float:right;">Last updated 2017-04-11 01:22:59 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -105,7 +105,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
<i style="float:right;">Last updated 2017-04-10 22:47:43 </i> <i style="float:right;">Last updated 2017-04-11 01:22:59 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -723,7 +723,7 @@ table.insert element.parent, element.parent\removeChild(element),
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
<i style="float:right;">Last updated 2017-04-10 22:47:43 </i> <i style="float:right;">Last updated 2017-04-11 01:22:59 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -126,7 +126,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
<i style="float:right;">Last updated 2017-04-10 22:47:43 </i> <i style="float:right;">Last updated 2017-04-11 01:22:59 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -213,9 +213,9 @@ pop.mousemoved = function(x, y, dx, dy, element)
if element == nil then if element == nil then
element = pop.screen element = pop.screen
end end
if (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 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 pop.hovered = element
for i = #element.child, 1, -1 do for i = 1, #element.child do
pop.mousemoved(x, y, dx, dy, element.child[i]) pop.mousemoved(x, y, dx, dy, element.child[i])
end end
end end
@ -230,8 +230,8 @@ pop.mousepressed = function(x, y, button, element)
element = pop.screen element = pop.screen
end end
local handled = false local handled = false
if (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 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 = #element.child, 1, -1 do for i = 1, #element.child do
do do
handled = pop.mousepressed(x, y, button, element.child[i]) handled = pop.mousepressed(x, y, button, element.child[i])
if handled then if handled then
@ -240,7 +240,7 @@ pop.mousepressed = function(x, y, button, element)
end end
end end
if not (handled) then if not (handled) then
if element.mousepressed and element.data.draw then if element.mousepressed then
do do
handled = element:mousepressed(x - element.data.x, y - element.data.y, button) handled = element:mousepressed(x - element.data.x, y - element.data.y, button)
if handled then if handled then
@ -257,14 +257,14 @@ pop.mousereleased = function(x, y, button, element)
local mousereleasedHandled = false local mousereleasedHandled = false
if element then 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 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 = #element.child, 1, -1 do for i = 1, #element.child do
clickedHandled, mousereleasedHandled = pop.mousereleased(x, y, button, element.child[i]) clickedHandled, mousereleasedHandled = pop.mousereleased(x, y, button, element.child[i])
if clickedHandled or mousereleasedHandled then if clickedHandled or mousereleasedHandled then
return clickedHandled, mousereleasedHandled return clickedHandled, mousereleasedHandled
end end
end end
if not (clickedHandled or mousereleasedHandled) then if not (clickedHandled or mousereleasedHandled) then
if element.clicked and element.data.draw then if element.clicked then
clickedHandled = element:clicked(x - element.data.x, y - element.data.y, button) clickedHandled = element:clicked(x - element.data.x, y - element.data.y, button)
end end
if element.mousereleased then if element.mousereleased then

View File

@ -267,11 +267,11 @@ pop.draw = (element=pop.screen) ->
pop.mousemoved = (x, y, dx, dy, element=pop.screen) -> pop.mousemoved = (x, y, dx, dy, element=pop.screen) ->
-- first we find out if we're hovering over anything and set pop.hovered -- first we find out if we're hovering over anything and set pop.hovered
if (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) 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)
-- okay, we're over this element for sure, but let's check its children -- okay, we're over this element for sure, but let's check its children
pop.hovered = element pop.hovered = element
-- check in reverse order, it will set pop.hovered to any that match -- check in reverse order, it will set pop.hovered to any that match
for i = #element.child, 1, -1 for i = 1, #element.child
pop.mousemoved x, y, dx, dy, element.child[i] pop.mousemoved x, y, dx, dy, element.child[i]
--- @todo Implement a way for an element to attach itself to `love.mousemoved()` events? --- @todo Implement a way for an element to attach itself to `love.mousemoved()` events?
@ -304,16 +304,16 @@ pop.mousepressed = (x, y, button, element) ->
handled = false handled = false
-- if it is inside the current element.. -- if it is inside the current element..
if (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) 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 -- check its child elements in reverse order, returning if something handles it
for i = #element.child, 1, -1 for i = 1, #element.child
if handled = pop.mousepressed x, y, button, element.child[i] if handled = pop.mousepressed x, y, button, element.child[i]
return handled return handled
-- if a child hasn't handled it yet (note: this check doesn't seem neccessary) -- if a child hasn't handled it yet (note: this check doesn't seem neccessary)
unless handled unless handled
-- if we can handle it and are visible, try to handle it, and set pop.focused -- if we can handle it, try to handle it, and set pop.focused
if element.mousepressed and element.data.draw if element.mousepressed
if handled = element\mousepressed x - element.data.x, y - element.data.y, button if handled = element\mousepressed x - element.data.x, y - element.data.y, button
pop.focused = element pop.focused = element
@ -343,15 +343,14 @@ pop.mousereleased = (x, y, button, element) ->
if 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) 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 -- check its children in reverse for handling a clicked or mousereleased event
for i = #element.child, 1, -1 for i = 1, #element.child
clickedHandled, mousereleasedHandled = pop.mousereleased x, y, button, element.child[i] clickedHandled, mousereleasedHandled = pop.mousereleased x, y, button, element.child[i]
if clickedHandled or mousereleasedHandled if clickedHandled or mousereleasedHandled
return clickedHandled, mousereleasedHandled return clickedHandled, mousereleasedHandled
-- if that doesn't work, we try to handle it ourselves (note: again, this check seems unneccessary) -- if that doesn't work, we try to handle it ourselves (note: again, this check seems unneccessary)
unless clickedHandled or mousereleasedHandled unless clickedHandled or mousereleasedHandled
-- clicked only happens on visible elements, mousereleased happens either way if element.clicked
if element.clicked and element.data.draw
clickedHandled = element\clicked x - element.data.x, y - element.data.y, button clickedHandled = element\clicked x - element.data.x, y - element.data.y, button
if element.mousereleased if element.mousereleased
mousereleasedHandled = element\mousereleased x - element.data.x, y - element.data.y, button mousereleasedHandled = element\mousereleased x - element.data.x, y - element.data.y, button