#226 updated mouse events WIP

This commit is contained in:
Mikayla
2023-05-07 01:27:36 +00:00
parent c7edd8c487
commit e26dc905f8
29 changed files with 109 additions and 69 deletions

View File

@@ -176,7 +176,7 @@ local function hazard_button(args)
-- set the value (true simulates pressing the button)
---@param val boolean new value
function e.set_value(val)
if val then e.handle_mouse(core.events.mouse_generic("", core.events.click_type.VIRTUAL, 1, 1)) end
if val then e.handle_mouse(core.events.mouse_generic("", core.events.click_button.VIRTUAL, core.events.click_type.UP, 1, 1)) end
end
-- show the button as disabled

View File

@@ -76,7 +76,7 @@ local function push_button(args)
-- set the value (true simulates pressing the button)
---@param val boolean new value
function e.set_value(val)
if val then e.handle_mouse(core.events.mouse_generic("", core.events.click_type.VIRTUAL, 1, 1)) end
if val then e.handle_mouse(core.events.mouse_generic("", core.events.click_button.VIRTUAL, core.events.click_type.UP, 1, 1)) end
end
-- show butten as enabled

View File

@@ -26,7 +26,7 @@ local function core_map(args)
args.height = 18
-- inherit only foreground color
args.fg_bg = core.graphics.cpair(args.parent.get_fg_bg().fgd, colors.gray)
args.fg_bg = core.cpair(args.parent.get_fg_bg().fgd, colors.gray)
-- create new graphics element base object
local e = element.new(args)

View File

@@ -37,7 +37,7 @@ local function pipenet(args)
args.y = args.y or 1
if args.bg ~= nil then
args.fg_bg = core.graphics.cpair(args.bg, args.bg)
args.fg_bg = core.cpair(args.bg, args.bg)
end
-- create new graphics element base object
@@ -55,7 +55,7 @@ local function pipenet(args)
e.window.setCursorPos(x, y)
local c = core.graphics.cpair(pipe.color, e.fg_bg.bkg)
local c = core.cpair(pipe.color, e.fg_bg.bkg)
if pipe.align_tr then
-- cross width then height

View File

@@ -5,7 +5,7 @@ local util = require("scada-common.util")
local core = require("graphics.core")
local element = require("graphics.element")
local TEXT_ALIGN = core.graphics.TEXT_ALIGN
local TEXT_ALIGN = core.TEXT_ALIGN
---@class textbox_args
---@field text string text to show