mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
#184 updated supervisor for new mouse events
This commit is contained in:
parent
513c72ea79
commit
e159dbb850
@ -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
|
||||
|
@ -6,7 +6,7 @@ local core = require("graphics.core")
|
||||
|
||||
local style = {}
|
||||
|
||||
local cpair = core.graphics.cpair
|
||||
local cpair = core.cpair
|
||||
|
||||
-- GLOBAL --
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user