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 = =>
|
@window_area.clicked = =>
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
|
--print "window_area " .. tostring @window_area
|
||||||
|
|
||||||
selected = false
|
selected = false
|
||||||
mx = 0
|
mx = 0
|
||||||
my = 0
|
my = 0
|
||||||
|
5
init.lua
5
init.lua
@ -252,7 +252,7 @@ pop.mousepressed = function(x, y, button, element)
|
|||||||
end
|
end
|
||||||
if element.mousepressed then
|
if element.mousepressed then
|
||||||
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 ~= false then
|
if handled then
|
||||||
pop.focused = element
|
pop.focused = element
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -359,6 +359,9 @@ pop.debugDraw = function(element)
|
|||||||
if element == nil then
|
if element == nil then
|
||||||
element = pop.screen
|
element = pop.screen
|
||||||
end
|
end
|
||||||
|
if element.debugDraw then
|
||||||
|
element:debugDraw()
|
||||||
|
end
|
||||||
graphics.setLineWidth(1)
|
graphics.setLineWidth(1)
|
||||||
graphics.setColor(0, 0, 0, 100)
|
graphics.setColor(0, 0, 0, 100)
|
||||||
graphics.rectangle("fill", element.data.x, element.data.y, element.data.w, element.data.h)
|
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 a child hasn't handled it yet, try to handle it, and set pop.focused
|
||||||
if element.mousepressed
|
if element.mousepressed
|
||||||
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 != false
|
if handled -- you have to explicitly handle a mousepressed event to become focused
|
||||||
pop.focused = element
|
pop.focused = element
|
||||||
|
|
||||||
-- return whether or not we have handled the event
|
-- return whether or not we have handled the event
|
||||||
@ -385,10 +385,13 @@ pop.mousereleased = (x, y, button, element) ->
|
|||||||
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
|
||||||
if clickedHandled != false or mousereleasedHandled != false
|
if clickedHandled != false or mousereleasedHandled != false
|
||||||
|
--print "#{clickedHandled}, #{mousereleasedHandled}, #{element}, #{element.data.type}"
|
||||||
return clickedHandled, mousereleasedHandled
|
return clickedHandled, mousereleasedHandled
|
||||||
|
|
||||||
pop.mousereleased x, y, button, pop.screen
|
pop.mousereleased x, y, button, pop.screen
|
||||||
|
|
||||||
|
--print "#{clickedHandled}, #{mousereleasedHandled}, #{element}"
|
||||||
|
|
||||||
return clickedHandled, mousereleasedHandled
|
return clickedHandled, mousereleasedHandled
|
||||||
|
|
||||||
|
|
||||||
@ -489,7 +492,9 @@ pop.export = (element=pop.screen) ->
|
|||||||
--- @see Element
|
--- @see Element
|
||||||
|
|
||||||
pop.debugDraw = (element=pop.screen) ->
|
pop.debugDraw = (element=pop.screen) ->
|
||||||
--@todo Remove element.debugDraw functions.
|
if element.debugDraw
|
||||||
|
element\debugDraw!
|
||||||
|
|
||||||
graphics.setLineWidth 1
|
graphics.setLineWidth 1
|
||||||
graphics.setColor 0, 0, 0, 100
|
graphics.setColor 0, 0, 0, 100
|
||||||
graphics.rectangle "fill", element.data.x, element.data.y, element.data.w, element.data.h
|
graphics.rectangle "fill", element.data.x, element.data.y, element.data.w, element.data.h
|
||||||
|
Loading…
Reference in New Issue
Block a user