diff --git a/coordinator/startup.lua b/coordinator/startup.lua index eca2bcc..367c1ca 100644 --- a/coordinator/startup.lua +++ b/coordinator/startup.lua @@ -20,7 +20,7 @@ local sounder = require("coordinator.sounder") local apisessions = require("coordinator.session.apisessions") -local COORDINATOR_VERSION = "v0.15.1" +local COORDINATOR_VERSION = "v0.15.2" local println = util.println local println_ts = util.println_ts diff --git a/graphics/element.lua b/graphics/element.lua index 46b9ca1..b865af0 100644 --- a/graphics/element.lua +++ b/graphics/element.lua @@ -177,15 +177,24 @@ function element.new(args) self.bounds.y2 = self.position.y + f.h - 1 end - -- check if a coordinate is within the bounds of this element + -- check if a coordinate relative to the parent is within the bounds of this element ---@param x integer ---@param y integer - function protected.in_bounds(x, y) + function protected.in_window_bounds(x, y) local in_x = x >= self.bounds.x1 and x <= self.bounds.x2 local in_y = y >= self.bounds.y1 and y <= self.bounds.y2 return in_x and in_y end + -- check if a coordinate relative to this window is within the bounds of this element + ---@param x integer + ---@param y integer + function protected.in_frame_bounds(x, y) + local in_x = x >= 1 and x <= protected.frame.w + local in_y = y >= 1 and y <= protected.frame.h + return in_x and in_y + end + -- luacheck: push ignore ---@diagnostic disable: unused-local, unused-vararg @@ -503,7 +512,7 @@ function element.new(args) function public.handle_mouse(event) local x_ini, y_ini = event.initial.x, event.initial.y - local ini_in = protected.in_bounds(x_ini, y_ini) + local ini_in = protected.in_window_bounds(x_ini, y_ini) if ini_in then local event_T = core.events.mouse_transposed(event, self.position.x, self.position.y) diff --git a/graphics/elements/controls/push_button.lua b/graphics/elements/controls/push_button.lua index 7f91ea5..27be991 100644 --- a/graphics/elements/controls/push_button.lua +++ b/graphics/elements/controls/push_button.lua @@ -84,7 +84,7 @@ local function push_button(args) show_pressed() elseif event.type == CLICK_TYPE.UP then show_unpressed() - if e.in_bounds(event.current.x, event.current.y) then + if e.in_frame_bounds(event.current.x, event.current.y) then args.callback() end end diff --git a/graphics/elements/controls/sidebar.lua b/graphics/elements/controls/sidebar.lua index a20cb72..45771b2 100644 --- a/graphics/elements/controls/sidebar.lua +++ b/graphics/elements/controls/sidebar.lua @@ -93,7 +93,7 @@ local function sidebar(args) elseif event.type == CLICK_TYPE.DOWN then draw(true, cur_idx) elseif event.type == CLICK_TYPE.UP then - if cur_idx == ini_idx and e.in_bounds(event.current.x, event.current.y) then + if cur_idx == ini_idx and e.in_frame_bounds(event.current.x, event.current.y) then e.value = cur_idx draw(false) args.callback(e.value) diff --git a/pocket/startup.lua b/pocket/startup.lua index d1c54d0..075919d 100644 --- a/pocket/startup.lua +++ b/pocket/startup.lua @@ -17,7 +17,7 @@ local coreio = require("pocket.coreio") local pocket = require("pocket.pocket") local renderer = require("pocket.renderer") -local POCKET_VERSION = "alpha-v0.3.1" +local POCKET_VERSION = "alpha-v0.3.2" local println = util.println local println_ts = util.println_ts diff --git a/reactor-plc/startup.lua b/reactor-plc/startup.lua index c3b546f..1a7f550 100644 --- a/reactor-plc/startup.lua +++ b/reactor-plc/startup.lua @@ -18,7 +18,7 @@ local plc = require("reactor-plc.plc") local renderer = require("reactor-plc.renderer") local threads = require("reactor-plc.threads") -local R_PLC_VERSION = "v1.3.1" +local R_PLC_VERSION = "v1.3.2" local println = util.println local println_ts = util.println_ts diff --git a/rtu/startup.lua b/rtu/startup.lua index a217ac3..6ff5e7d 100644 --- a/rtu/startup.lua +++ b/rtu/startup.lua @@ -28,7 +28,7 @@ local sna_rtu = require("rtu.dev.sna_rtu") local sps_rtu = require("rtu.dev.sps_rtu") local turbinev_rtu = require("rtu.dev.turbinev_rtu") -local RTU_VERSION = "v1.2.1" +local RTU_VERSION = "v1.2.2" local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE