Merge branch 'devel' into front-panels

This commit is contained in:
Mikayla Fischler 2023-05-23 20:25:19 -04:00
commit e313b77abc
5 changed files with 16 additions and 7 deletions

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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