entities - display on overlay
This commit is contained in:
@@ -22,10 +22,12 @@ local config = Config.load('Entities', { })
|
|||||||
local page = UI.Page {
|
local page = UI.Page {
|
||||||
menuBar = UI.MenuBar {
|
menuBar = UI.MenuBar {
|
||||||
buttons = {
|
buttons = {
|
||||||
{ text = 'Project', event = 'project' },
|
{ text = 'Projector', event = 'project' },
|
||||||
|
{ text = 'Totals', event = 'totals' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
grid = UI.ScrollingGrid {
|
grid = UI.ScrollingGrid {
|
||||||
|
y = 2,
|
||||||
columns = {
|
columns = {
|
||||||
{ heading = 'Name', key = 'displayName' },
|
{ heading = 'Name', key = 'displayName' },
|
||||||
{ heading = ' X', key = 'x', width = 3, justify = 'right' },
|
{ heading = ' X', key = 'x', width = 3, justify = 'right' },
|
||||||
@@ -51,6 +53,11 @@ end
|
|||||||
function page:eventHandler(event)
|
function page:eventHandler(event)
|
||||||
if event.type == 'quit' then
|
if event.type == 'quit' then
|
||||||
Event.exitPullEvents()
|
Event.exitPullEvents()
|
||||||
|
|
||||||
|
elseif event.type == 'project' then
|
||||||
|
config.totals = not config.totals
|
||||||
|
Config.update('Entities', config)
|
||||||
|
|
||||||
elseif event.type == 'project' then
|
elseif event.type == 'project' then
|
||||||
config.projecting = not config.projecting
|
config.projecting = not config.projecting
|
||||||
if config.projecting then
|
if config.projecting then
|
||||||
@@ -60,6 +67,7 @@ function page:eventHandler(event)
|
|||||||
end
|
end
|
||||||
Config.update('Entities', config)
|
Config.update('Entities', config)
|
||||||
end
|
end
|
||||||
|
|
||||||
UI.Page.eventHandler(self, event)
|
UI.Page.eventHandler(self, event)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -73,6 +81,18 @@ Event.onInterval(.5, function()
|
|||||||
Project:drawPoints(meta, entities, 'X', 0xFFDF50AA)
|
Project:drawPoints(meta, entities, 'X', 0xFFDF50AA)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if config.totals then
|
||||||
|
local t = { }
|
||||||
|
for _,v in pairs(entities) do
|
||||||
|
if t[v.displayName] then
|
||||||
|
t[v.displayName].z = t[v.displayName].z + 1
|
||||||
|
else
|
||||||
|
t[v.displayName] = { displayName = v.displayName, z = 1 }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
entities = t
|
||||||
|
end
|
||||||
|
|
||||||
page.grid:setValues(entities)
|
page.grid:setValues(entities)
|
||||||
page.grid:draw()
|
page.grid:draw()
|
||||||
page:sync()
|
page:sync()
|
||||||
|
|||||||
Reference in New Issue
Block a user