mirror of
https://github.com/TangentFoxy/Pop.Box.git
synced 2024-12-15 12:44:20 +00:00
fixed a derp
This commit is contained in:
parent
d0394c596a
commit
5089a87fe6
@ -81,6 +81,8 @@ class window extends element
|
||||
@window_area.clicked = =>
|
||||
return nil
|
||||
|
||||
--print "window_area " .. tostring @window_area
|
||||
|
||||
selected = false
|
||||
mx = 0
|
||||
my = 0
|
||||
|
5
init.lua
5
init.lua
@ -252,7 +252,7 @@ pop.mousepressed = function(x, y, button, element)
|
||||
end
|
||||
if element.mousepressed then
|
||||
handled = element:mousepressed(x - element.data.x, y - element.data.y, button)
|
||||
if handled ~= false then
|
||||
if handled then
|
||||
pop.focused = element
|
||||
end
|
||||
end
|
||||
@ -359,6 +359,9 @@ pop.debugDraw = function(element)
|
||||
if element == nil then
|
||||
element = pop.screen
|
||||
end
|
||||
if element.debugDraw then
|
||||
element:debugDraw()
|
||||
end
|
||||
graphics.setLineWidth(1)
|
||||
graphics.setColor(0, 0, 0, 100)
|
||||
graphics.rectangle("fill", element.data.x, element.data.y, element.data.w, element.data.h)
|
||||
|
@ -323,7 +323,7 @@ pop.mousepressed = (x, y, button, element) ->
|
||||
-- if a child hasn't handled it yet, try to handle it, and set pop.focused
|
||||
if element.mousepressed
|
||||
handled = element\mousepressed x - element.data.x, y - element.data.y, button
|
||||
if handled != false
|
||||
if handled -- you have to explicitly handle a mousepressed event to become focused
|
||||
pop.focused = element
|
||||
|
||||
-- return whether or not we have handled the event
|
||||
@ -385,10 +385,13 @@ pop.mousereleased = (x, y, button, element) ->
|
||||
if element.mousereleased
|
||||
mousereleasedHandled = element\mousereleased x - element.data.x, y - element.data.y, button
|
||||
if clickedHandled != false or mousereleasedHandled != false
|
||||
--print "#{clickedHandled}, #{mousereleasedHandled}, #{element}, #{element.data.type}"
|
||||
return clickedHandled, mousereleasedHandled
|
||||
|
||||
pop.mousereleased x, y, button, pop.screen
|
||||
|
||||
--print "#{clickedHandled}, #{mousereleasedHandled}, #{element}"
|
||||
|
||||
return clickedHandled, mousereleasedHandled
|
||||
|
||||
|
||||
@ -489,7 +492,9 @@ pop.export = (element=pop.screen) ->
|
||||
--- @see Element
|
||||
|
||||
pop.debugDraw = (element=pop.screen) ->
|
||||
--@todo Remove element.debugDraw functions.
|
||||
if element.debugDraw
|
||||
element\debugDraw!
|
||||
|
||||
graphics.setLineWidth 1
|
||||
graphics.setColor 0, 0, 0, 100
|
||||
graphics.rectangle "fill", element.data.x, element.data.y, element.data.w, element.data.h
|
||||
|
Loading…
Reference in New Issue
Block a user