#184 updated supervisor for new mouse events

This commit is contained in:
Mikayla Fischler 2023-05-11 20:06:41 -04:00
parent 513c72ea79
commit e159dbb850
4 changed files with 9 additions and 16 deletions

View File

@ -22,10 +22,10 @@ local LED = require("graphics.elements.indicators.led")
local LEDPair = require("graphics.elements.indicators.ledpair")
local RGBLED = require("graphics.elements.indicators.ledrgb")
local TEXT_ALIGN = core.graphics.TEXT_ALIGN
local TEXT_ALIGN = core.TEXT_ALIGN
local cpair = core.graphics.cpair
local border = core.graphics.border
local cpair = core.cpair
local border = core.border
-- create new main view
---@param panel graphics_element main displaybox

View File

@ -6,7 +6,7 @@ local core = require("graphics.core")
local style = {}
local cpair = core.graphics.cpair
local cpair = core.cpair
-- GLOBAL --

View File

@ -70,9 +70,9 @@ end
function renderer.ui_ready() return ui.display ~= nil end
-- handle a mouse event
---@param event mouse_interaction
---@param event mouse_interaction|nil
function renderer.handle_mouse(event)
if ui.display ~= nil then
if ui.display ~= nil and event ~= nil then
ui.display.handle_mouse(event)
end
end

View File

@ -174,16 +174,9 @@ local function main()
-- got a packet
local packet = superv_comms.parse_packet(param1, param2, param3, param4, param5)
superv_comms.handle_packet(packet)
elseif event == "mouse_click" then
-- handle a monitor touch event
renderer.handle_mouse(core.events.touch(param1, param2, param3))
log.debug(util.sprintf("mouse_click: %s [%d, %d]", param1, param2, param3))
elseif event == "mouse_drag" then
log.debug(util.sprintf("mouse_drag: %s [%d, %d]", param1, param2, param3))
elseif event == "mouse_scroll" then
log.debug(util.sprintf("mouse_scroll: %s [%d, %d]", param1, param2, param3))
elseif event == "mouse_up" then
log.debug(util.sprintf("mouse_up: %s [%d, %d]", param1, param2, param3))
elseif event == "mouse_click" or event == "mouse_up" or event == "mouse_drag" or event == "mouse_scroll" then
-- handle a mouse event
renderer.handle_mouse(core.events.new_mouse_event(event, param1, param2, param3))
end
-- check for termination request