commenting and fixed a bug with mousehandling

This commit is contained in:
Paul Liverman III 2016-04-20 14:12:32 -07:00
parent be81f3d1a1
commit 441e0647b8
6 changed files with 106 additions and 103 deletions

View File

@ -86,6 +86,7 @@ function love.update(dt)
if not videoFile:isPlaying() then if not videoFile:isPlaying() then
videoFile:rewind() videoFile:rewind()
videoFile:play() -- sometimes rewinding at the end of play fails to start a loop
end end
end end
@ -94,7 +95,6 @@ function love.draw()
if debugDraw then if debugDraw then
pop.debugDraw() pop.debugDraw()
--w2:debugDraw()
end end
end end
@ -131,7 +131,7 @@ function love.keypressed(key)
end end
if (key == "p") and (not handled) then if (key == "p") and (not handled) then
pop.printElementStack() pop.printElementTree()
end end
if (key == "escape") and (not handled) then if (key == "escape") and (not handled) then

View File

@ -54,12 +54,12 @@ do
return self return self
end, end,
addChild = function(self, child) addChild = function(self, child)
self.window:addChild(child) self.area:addChild(child)
return self return self
end, end,
removeChild = function(self, child) removeChild = function(self, child)
local result = self.window:removeChild(child) local result = self.area:removeChild(child)
if result == self.window then if result == self.area then
return self return self
elseif type(result) == "string" then elseif type(result) == "string" then
for k, v in ipairs(self.child) do for k, v in ipairs(self.child) do
@ -74,14 +74,14 @@ do
end end
end, end,
getChildren = function(self) getChildren = function(self)
return self.window.child return self.area.child
end, end,
align = function(self, horizontal, vertical, toPixel) align = function(self, horizontal, vertical, toPixel)
_class_0.__parent.__base.align(self, horizontal, vertical, toPixel) _class_0.__parent.__base.align(self, horizontal, vertical, toPixel)
for i = 1, #self.child do for i = 1, #self.child do
self.child[i]:align() self.child[i]:align()
end end
self.window:move(nil, self.head:getHeight()) self.area:move(nil, self.head:getHeight())
return self return self
end, end,
setSize = function(self, w, h) setSize = function(self, w, h)
@ -99,7 +99,7 @@ do
else else
self.head:setWidth(w) self.head:setWidth(w)
end end
self.window:setWidth(w) self.area:setWidth(w)
self.w = w self.w = w
self.x = self.x + x self.x = self.x + x
self.title:align() self.title:align()
@ -115,12 +115,12 @@ do
elseif "right" == _exp_0 then elseif "right" == _exp_0 then
y = y - (h - self.h) y = y - (h - self.h)
end end
self.window:setHeight(h) self.area:setHeight(h)
self.h = h + self.head:getHeight() self.h = h + self.head:getHeight()
self.y = self.y + y self.y = self.y + y
end end
self.head:move(x, y) self.head:move(x, y)
self.window:move(x, y) self.area:move(x, y)
return self return self
end, end,
setWidth = function(self, w) setWidth = function(self, w)
@ -136,7 +136,7 @@ do
else else
self.head:setWidth(w) self.head:setWidth(w)
end end
self.window:setWidth(w) self.area:setWidth(w)
self.w = w self.w = w
self.x = self.x + x self.x = self.x + x
self.title:align() self.title:align()
@ -144,7 +144,7 @@ do
self.close:align() self.close:align()
end end
self.head:move(x) self.head:move(x)
self.window:move(x) self.area:move(x)
return self return self
end, end,
setHeight = function(self, h) setHeight = function(self, h)
@ -156,12 +156,12 @@ do
elseif "right" == _exp_0 then elseif "right" == _exp_0 then
y = y - (h - self.h) y = y - (h - self.h)
end end
self.window:setHeight(h) self.area:setHeight(h)
self.h = h + self.head:getHeight() self.h = h + self.head:getHeight()
self.y = self.y + y self.y = self.y + y
self.head:move(nil, y) self.head:move(nil, y)
self.title:move(nil, y) self.title:move(nil, y)
self.window:move(nil, y) self.area:move(nil, y)
return self return self
end, end,
setTitle = function(self, title) setTitle = function(self, title)
@ -250,24 +250,24 @@ do
_class_0.__parent.__init(self, parent) _class_0.__parent.__init(self, parent)
self.head = box(self, tBackground) self.head = box(self, tBackground)
self.title = text(self.head, title, tColor) self.title = text(self.head, title, tColor)
self.window = box(self, wBackground) self.area = box(self, wBackground)
self.close = box(self, closeImage) self.close = box(self, closeImage)
local height = self.title:getHeight() local height = self.title:getHeight()
self.head:setSize(self.w - height, height) self.head:setSize(self.w - height, height)
self.window:move(nil, height) self.area:move(nil, height)
self.close:align("right"):setSize(height, height) self.close:align("right"):setSize(height, height)
self:setSize(100, 80) self:setSize(100, 80)
self.child = { self.child = {
self.head, self.head,
self.title, self.title,
self.window, self.area,
self.close self.close
} }
self.titleOverflow = "trunicate" self.titleOverflow = "trunicate"
self.window.mousepressed = function() self.area.mousepressed = function()
return true return true
end end
self.window.clicked = function() self.area.clicked = function()
return true return true
end end
self.close.clicked = function() self.close.clicked = function()

View File

@ -1,3 +1,10 @@
local pop = {
_VERSION = 'Pop.Box v0.0.0',
_DESCRIPTION = 'GUI library for LOVE, designed for ease of use',
_URL = 'http://github.com/Guard13007/Pop.Box',
_LICENSE = 'The MIT License (MIT)',
_AUTHOR = 'Paul Liverman III'
}
if not (love.getVersion) then if not (love.getVersion) then
error("Pop.Box only supports LOVE versions >= 0.9.1") error("Pop.Box only supports LOVE versions >= 0.9.1")
end end
@ -11,7 +18,6 @@ insert = table.insert
local inheritsFromElement local inheritsFromElement
inheritsFromElement = require(tostring(...) .. "/util").inheritsFromElement inheritsFromElement = require(tostring(...) .. "/util").inheritsFromElement
local path = ... local path = ...
local pop = { }
pop.elements = { } pop.elements = { }
pop.skins = { } pop.skins = { }
pop.screen = false pop.screen = false
@ -139,9 +145,11 @@ pop.mousepressed = function(x, y, button, element)
local handled = false local handled = false
if (x >= element.x) and (x <= element.x + element.w) and (y >= element.y) and (y <= element.y + element.h) then if (x >= element.x) and (x <= element.x + element.w) and (y >= element.y) and (y <= element.y + element.h) then
for i = #element.child, 1, -1 do for i = #element.child, 1, -1 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
break return handled
end
end end
end end
if not (handled) then if not (handled) then
@ -165,7 +173,7 @@ pop.mousereleased = function(x, y, button, element)
for i = #element.child, 1, -1 do for i = #element.child, 1, -1 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
break return clickedHandled, mousereleasedHandled
end end
end end
if not (clickedHandled or mousereleasedHandled) then if not (clickedHandled or mousereleasedHandled) then
@ -180,6 +188,9 @@ pop.mousereleased = function(x, y, button, element)
end end
end end
end end
else
print("mousereleased", x, y, button)
pop.mousereleased(x, y, button, pop.screen)
end end
return clickedHandled, mousereleasedHandled return clickedHandled, mousereleasedHandled
end end
@ -254,7 +265,7 @@ pop.debugDraw = function(element)
pop.debugDraw(element.child[i]) pop.debugDraw(element.child[i])
end end
end end
pop.printElementStack = function(element, depth) pop.printElementTree = function(element, depth)
if element == nil then if element == nil then
element = pop.screen element = pop.screen
end end

View File

@ -54,12 +54,12 @@ do
return self return self
end, end,
addChild = function(self, child) addChild = function(self, child)
self.window:addChild(child) self.area:addChild(child)
return self return self
end, end,
removeChild = function(self, child) removeChild = function(self, child)
local result = self.window:removeChild(child) local result = self.area:removeChild(child)
if result == self.window then if result == self.area then
return self return self
elseif type(result) == "string" then elseif type(result) == "string" then
for k, v in ipairs(self.child) do for k, v in ipairs(self.child) do
@ -74,14 +74,14 @@ do
end end
end, end,
getChildren = function(self) getChildren = function(self)
return self.window.child return self.area.child
end, end,
align = function(self, horizontal, vertical, toPixel) align = function(self, horizontal, vertical, toPixel)
_class_0.__parent.__base.align(self, horizontal, vertical, toPixel) _class_0.__parent.__base.align(self, horizontal, vertical, toPixel)
for i = 1, #self.child do for i = 1, #self.child do
self.child[i]:align() self.child[i]:align()
end end
self.window:move(nil, self.head:getHeight()) self.area:move(nil, self.head:getHeight())
return self return self
end, end,
setSize = function(self, w, h) setSize = function(self, w, h)
@ -99,7 +99,7 @@ do
else else
self.head:setWidth(w) self.head:setWidth(w)
end end
self.window:setWidth(w) self.area:setWidth(w)
self.w = w self.w = w
self.x = self.x + x self.x = self.x + x
self.title:align() self.title:align()
@ -115,12 +115,12 @@ do
elseif "right" == _exp_0 then elseif "right" == _exp_0 then
y = y - (h - self.h) y = y - (h - self.h)
end end
self.window:setHeight(h) self.area:setHeight(h)
self.h = h + self.head:getHeight() self.h = h + self.head:getHeight()
self.y = self.y + y self.y = self.y + y
end end
self.head:move(x, y) self.head:move(x, y)
self.window:move(x, y) self.area:move(x, y)
return self return self
end, end,
setWidth = function(self, w) setWidth = function(self, w)
@ -136,7 +136,7 @@ do
else else
self.head:setWidth(w) self.head:setWidth(w)
end end
self.window:setWidth(w) self.area:setWidth(w)
self.w = w self.w = w
self.x = self.x + x self.x = self.x + x
self.title:align() self.title:align()
@ -144,7 +144,7 @@ do
self.close:align() self.close:align()
end end
self.head:move(x) self.head:move(x)
self.window:move(x) self.area:move(x)
return self return self
end, end,
setHeight = function(self, h) setHeight = function(self, h)
@ -156,12 +156,12 @@ do
elseif "right" == _exp_0 then elseif "right" == _exp_0 then
y = y - (h - self.h) y = y - (h - self.h)
end end
self.window:setHeight(h) self.area:setHeight(h)
self.h = h + self.head:getHeight() self.h = h + self.head:getHeight()
self.y = self.y + y self.y = self.y + y
self.head:move(nil, y) self.head:move(nil, y)
self.title:move(nil, y) self.title:move(nil, y)
self.window:move(nil, y) self.area:move(nil, y)
return self return self
end, end,
setTitle = function(self, title) setTitle = function(self, title)
@ -250,24 +250,24 @@ do
_class_0.__parent.__init(self, parent) _class_0.__parent.__init(self, parent)
self.head = box(self, tBackground) self.head = box(self, tBackground)
self.title = text(self.head, title, tColor) self.title = text(self.head, title, tColor)
self.window = box(self, wBackground) self.area = box(self, wBackground)
self.close = box(self, closeImage) self.close = box(self, closeImage)
local height = self.title:getHeight() local height = self.title:getHeight()
self.head:setSize(self.w - height, height) self.head:setSize(self.w - height, height)
self.window:move(nil, height) self.area:move(nil, height)
self.close:align("right"):setSize(height, height) self.close:align("right"):setSize(height, height)
self:setSize(100, 80) self:setSize(100, 80)
self.child = { self.child = {
self.head, self.head,
self.title, self.title,
self.window, self.area,
self.close self.close
} }
self.titleOverflow = "trunicate" self.titleOverflow = "trunicate"
self.window.mousepressed = function() self.area.mousepressed = function()
return true return true
end end
self.window.clicked = function() self.area.clicked = function()
return true return true
end end
self.close.clicked = function() self.close.clicked = function()

View File

@ -1,3 +1,10 @@
local pop = {
_VERSION = 'Pop.Box v0.0.0',
_DESCRIPTION = 'GUI library for LOVE, designed for ease of use',
_URL = 'http://github.com/Guard13007/Pop.Box',
_LICENSE = 'The MIT License (MIT)',
_AUTHOR = 'Paul Liverman III'
}
if not (love.getVersion) then if not (love.getVersion) then
error("Pop.Box only supports LOVE versions >= 0.9.1") error("Pop.Box only supports LOVE versions >= 0.9.1")
end end
@ -11,7 +18,6 @@ insert = table.insert
local inheritsFromElement local inheritsFromElement
inheritsFromElement = require(tostring(...) .. "/util").inheritsFromElement inheritsFromElement = require(tostring(...) .. "/util").inheritsFromElement
local path = ... local path = ...
local pop = { }
pop.elements = { } pop.elements = { }
pop.skins = { } pop.skins = { }
pop.screen = false pop.screen = false
@ -139,9 +145,11 @@ pop.mousepressed = function(x, y, button, element)
local handled = false local handled = false
if (x >= element.x) and (x <= element.x + element.w) and (y >= element.y) and (y <= element.y + element.h) then if (x >= element.x) and (x <= element.x + element.w) and (y >= element.y) and (y <= element.y + element.h) then
for i = #element.child, 1, -1 do for i = #element.child, 1, -1 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
break return handled
end
end end
end end
if not (handled) then if not (handled) then
@ -165,7 +173,7 @@ pop.mousereleased = function(x, y, button, element)
for i = #element.child, 1, -1 do for i = #element.child, 1, -1 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
break return clickedHandled, mousereleasedHandled
end end
end end
if not (clickedHandled or mousereleasedHandled) then if not (clickedHandled or mousereleasedHandled) then
@ -180,6 +188,9 @@ pop.mousereleased = function(x, y, button, element)
end end
end end
end end
else
print("mousereleased", x, y, button)
pop.mousereleased(x, y, button, pop.screen)
end end
return clickedHandled, mousereleasedHandled return clickedHandled, mousereleasedHandled
end end
@ -254,7 +265,7 @@ pop.debugDraw = function(element)
pop.debugDraw(element.child[i]) pop.debugDraw(element.child[i])
end end
end end
pop.printElementStack = function(element, depth) pop.printElementTree = function(element, depth)
if element == nil then if element == nil then
element = pop.screen element = pop.screen
end end

View File

@ -1,30 +1,9 @@
pop = { pop = {
_VERSION = 'Pop.Box v0.0.0' _VERSION: 'Pop.Box v0.0.0'
_DESCRIPTION = 'A GUI library for LOVE.' _DESCRIPTION: 'GUI library for LOVE, designed for ease of use'
_URL = 'http://github.com/Guard13007/Pop.Box' _URL: 'http://github.com/Guard13007/Pop.Box'
_LICENSE = ' _LICENSE: 'The MIT License (MIT)'
The MIT License (MIT) _AUTHOR: 'Paul Liverman III'
Copyright (c) 2015-2016 Paul Liverman III
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
'
} }
unless love.getVersion unless love.getVersion
@ -38,7 +17,6 @@ path = ...
pop.elements = {} pop.elements = {}
pop.skins = {} pop.skins = {}
--pop.events = {} --NOTE leave this commented out for now, as it may be needed again
pop.screen = false -- initialized in pop.load() pop.screen = false -- initialized in pop.load()
pop.focused = false pop.focused = false
@ -71,7 +49,7 @@ pop.load = ->
print "wrapper created: \"pop.#{name}()\"" print "wrapper created: \"pop.#{name}()\""
-- works just like above, except no wrappers -- works just like above, except no load calls or wrappers
skins = filesystem.getDirectoryItems "#{path}/skins" skins = filesystem.getDirectoryItems "#{path}/skins"
for i = 1, #skins for i = 1, #skins
@ -83,7 +61,7 @@ pop.load = ->
print "skin loaded: \"#{name}\"" print "skin loaded: \"#{name}\""
-- load extensions by just running them via require -- (again, similar) load extensions by just running them via require
extensions = filesystem.getDirectoryItems "#{path}/extensions" extensions = filesystem.getDirectoryItems "#{path}/extensions"
for i = 1, #extensions for i = 1, #extensions
@ -95,20 +73,20 @@ pop.load = ->
print "extension loaded: \"#{name}\"" print "extension loaded: \"#{name}\""
-- main window (called screen because there is a window element class) -- GUI screen area
pop.screen = pop.create("element", false)\setSize(graphics.getWidth!, graphics.getHeight!) pop.screen = pop.create("element", false)\setSize(graphics.getWidth!, graphics.getHeight!)
print "created \"pop.screen\"" print "created \"pop.screen\""
-- creates an element with specified parent (parent can be false or non-existent) -- creates an element (parent is an element, false, or nil (defaults to pop.screen))
pop.create = (element, parent=pop.screen, ...) -> pop.create = (element, parent=pop.screen, ...) ->
-- if valid parent element (includes default of pop.screen when no parent has been passed) -- if valid parent element
if inheritsFromElement parent if inheritsFromElement parent
element = pop.elements[element](parent, ...) element = pop.elements[element](parent, ...)
insert parent.child, element insert parent.child, element
-- if explicitly no parent -- if explicitly no parent
elseif parent == false elseif parent == false
element = pop.elements[element](false, ...) element = pop.elements[element](false, ...)
-- else we use pop.screen, and "parent" is actually first argument -- else use pop.screen, and "parent" is actually first argument
else else
element = pop.elements[element](pop.screen, parent, ...) element = pop.elements[element](pop.screen, parent, ...)
insert pop.screen.child, element insert pop.screen.child, element
@ -129,6 +107,7 @@ pop.draw = (element=pop.screen) ->
for i = 1, #element.child for i = 1, #element.child
pop.draw element.child[i] pop.draw element.child[i]
--TODO implement a way for an element to attach itself to mousemoved events
pop.mousemoved = (x, y, dx, dy) -> pop.mousemoved = (x, y, dx, dy) ->
if pop.focused and pop.focused.mousemoved if pop.focused and pop.focused.mousemoved
return pop.focused\mousemoved x, y, dx, dy return pop.focused\mousemoved x, y, dx, dy
@ -136,68 +115,68 @@ pop.mousemoved = (x, y, dx, dy) ->
return false return false
pop.mousepressed = (x, y, button, element) -> pop.mousepressed = (x, y, button, element) ->
-- start at the screen, print that we received an event
unless element unless element
print "mousepressed", x, y, button print "mousepressed", x, y, button
element = pop.screen element = pop.screen
-- have we handled the event?
handled = false handled = false
-- if it was inside the current element..
if (x >= element.x) and (x <= element.x + element.w) and (y >= element.y) and (y <= element.y + element.h) if (x >= element.x) and (x <= element.x + element.w) and (y >= element.y) and (y <= element.y + element.h)
-- check its child elements in reverse order, returning if something handles it
for i = #element.child, 1, -1 for i = #element.child, 1, -1
handled = pop.mousepressed x, y, button, element.child[i] if handled = pop.mousepressed x, y, button, element.child[i]
if handled return handled
break
-- if a child hasn't handled it yet
unless handled unless handled
-- if we can handle it and are visible, try to handle it, and set pop.focused
if element.mousepressed and (not element.excludeDraw) if element.mousepressed and (not element.excludeDraw)
if handled = element\mousepressed x - element.x, y - element.y, button if handled = element\mousepressed x - element.x, y - element.y, button
pop.focused = element pop.focused = element
--NOTE this might end up being needed in the future
-- if it is, add an ability for a mousepressed handler to cancel saving
-- the event, and make sure the window element's area does this
--pop.events[button] = element
-- have we handled the event?
return handled return handled
pop.mousereleased = (x, y, button, element) -> pop.mousereleased = (x, y, button, element) ->
-- we are trying to handle a clicked or mousereleased event
clickedHandled = false clickedHandled = false
mousereleasedHandled = false mousereleasedHandled = false
-- if we have an element, and are within its bounds
if element if element
if (x >= element.x) and (x <= element.x + element.w) and (y >= element.y) and (y <= element.y + element.h) if (x >= element.x) and (x <= element.x + element.w) and (y >= element.y) and (y <= element.y + element.h)
-- check its children in reverse for handling a clicked or mousereleased event
for i = #element.child, 1, -1 for i = #element.child, 1, -1
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
break return clickedHandled, mousereleasedHandled
-- if that doesn't work, we try to handle it ourselves
unless clickedHandled or mousereleasedHandled unless clickedHandled or mousereleasedHandled
-- clicked only happens on visible elements, mousereleased happens either way
if element.clicked and (not element.excludeDraw) if element.clicked and (not element.excludeDraw)
clickedHandled = element\clicked x - element.x, y - element.y, button clickedHandled = element\clicked x - element.x, y - element.y, button
if element.mousereleased if element.mousereleased
mousereleasedHandled = element\mousereleased x - element.x, y - element.y, button mousereleasedHandled = element\mousereleased x - element.x, y - element.y, button
-- if we clicked, we're focused!
if clickedHandled if clickedHandled
pop.focused = element pop.focused = element
--else -- else, default to pop.screen to begin! (and print that we received an event)
-- print "mousereleased", x, y, button else
-- if element = pop.events[button] print "mousereleased", x, y, button
-- if element.clicked and (not element.excludeDraw) --and (x >= element.x) and (x <= element.x + element.w) and (y >= element.y) and (y <= element.y + element.h) pop.mousereleased x, y, button, pop.screen
-- if clickedHandled = element\clicked x - element.x, y - element.y, button
-- pop.events[button] = nil
-- if element.mousereleased
-- if mousereleasedHandled = element\mousereleased x - element.x, y - element.y, button
-- pop.events[button] = nil
-- if (not clickedHandled) and (not mousereleasedHandled)
-- clickedHandled, mousereleasedHandled = pop.mousereleased x, y, button, pop.screen
return clickedHandled, mousereleasedHandled return clickedHandled, mousereleasedHandled
pop.keypressed = (key) -> pop.keypressed = (key) ->
print "keypressed", key print "keypressed", key
-- keypressed events must be on visible elements
element = pop.focused element = pop.focused
if element and element.keypressed and (not element.excludeDraw) if element and element.keypressed and (not element.excludeDraw)
return element.keypressed key return element.keypressed key
@ -207,6 +186,7 @@ pop.keypressed = (key) ->
pop.keyreleased = (key) -> pop.keyreleased = (key) ->
print "keyreleased", key print "keyreleased", key
-- keyreleased events are always called
element = pop.focused element = pop.focused
if element and element.keyreleased if element and element.keyreleased
return element.keyreleased key return element.keyreleased key
@ -216,6 +196,7 @@ pop.keyreleased = (key) ->
pop.textinput = (text) -> pop.textinput = (text) ->
print "textinput", text print "textinput", text
-- textinput events must be on visible elements
element = pop.focused element = pop.focused
if element and element.textinput and (not element.excludeDraw) if element and element.textinput and (not element.excludeDraw)
return element.textinput text return element.textinput text
@ -258,7 +239,7 @@ pop.debugDraw = (element=pop.screen) ->
for i = 1, #element.child for i = 1, #element.child
pop.debugDraw element.child[i] pop.debugDraw element.child[i]
pop.printElementStack = (element=pop.screen, depth=0) -> pop.printElementTree = (element=pop.screen, depth=0) ->
cls = element.__class.__name cls = element.__class.__name
if cls == "text" if cls == "text"