From f23b7e2c2f4f88759602fbd3589ba7f0c29bcc94 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 17 Dec 2023 12:56:08 -0500 Subject: [PATCH] fixed out of bounds coordinates crashing GUI for form fields --- graphics/core.lua | 2 +- graphics/elements/form/number_field.lua | 2 +- graphics/elements/form/text_field.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/graphics/core.lua b/graphics/core.lua index 63c706f..b38d786 100644 --- a/graphics/core.lua +++ b/graphics/core.lua @@ -7,7 +7,7 @@ local flasher = require("graphics.flasher") local core = {} -core.version = "2.0.8" +core.version = "2.0.9" core.flasher = flasher core.events = events diff --git a/graphics/elements/form/number_field.lua b/graphics/elements/form/number_field.lua index 7e1afd8..ddc09be 100644 --- a/graphics/elements/form/number_field.lua +++ b/graphics/elements/form/number_field.lua @@ -50,7 +50,7 @@ local function number_field(args) if core.events.was_clicked(event.type) then e.take_focus() - if event.type == MOUSE_CLICK.UP then + if event.type == MOUSE_CLICK.UP and e.in_frame_bounds(event.current.x, event.current.y) then ifield.move_cursor(event.current.x) end elseif event.type == MOUSE_CLICK.DOUBLE_CLICK then diff --git a/graphics/elements/form/text_field.lua b/graphics/elements/form/text_field.lua index aee910d..843ec24 100644 --- a/graphics/elements/form/text_field.lua +++ b/graphics/elements/form/text_field.lua @@ -45,7 +45,7 @@ local function text_field(args) if core.events.was_clicked(event.type) then e.take_focus() - if event.type == MOUSE_CLICK.UP then + if event.type == MOUSE_CLICK.UP and e.in_frame_bounds(event.current.x, event.current.y) then ifield.move_cursor(event.current.x) end elseif event.type == MOUSE_CLICK.DOUBLE_CLICK then