#226 multi button updated for new graphics mouse events

This commit is contained in:
Mikayla Fischler
2023-05-10 11:08:24 -04:00
parent 40fa0de7a3
commit 4ef1915137
3 changed files with 29 additions and 16 deletions

View File

@@ -6,8 +6,6 @@ local util = require("scada-common.util")
local core = require("graphics.core")
local element = require("graphics.element")
local CLICK_TYPE = core.events.CLICK_TYPE
---@class hazard_button_args
---@field text string text to show on button
---@field accent color accent color for hazard border
@@ -146,7 +144,7 @@ local function hazard_button(args)
---@param event mouse_interaction
function e.handle_mouse(event)
if e.enabled then
if event.type == CLICK_TYPE.TAP or event.type == CLICK_TYPE.UP then
if core.events.was_clicked(event.type) then
-- change text color to indicate clicked
e.window.setTextColor(args.accent)
e.window.setCursorPos(3, 2)