From 23b94d076be3c0ce012cac20b7c4c8cf4cc05239 Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:50:18 +0200 Subject: [PATCH] Frame drag fix Fixed a dragging bug on frames --- Basalt/Frame.lua | 18 ++++++++++-------- Basalt/Object.lua | 10 +++++++--- Basalt/main.lua | 2 +- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Basalt/Frame.lua b/Basalt/Frame.lua index 59342ed..643ac1e 100644 --- a/Basalt/Frame.lua +++ b/Basalt/Frame.lua @@ -853,14 +853,16 @@ return function(name, parent, pTerm, basalt) self:updateDraw() return true end - if(events["mouse_drag"]~=nil)then - for _, index in ipairs(eventZIndex["mouse_drag"]) do - if (events["mouse_drag"][index] ~= nil) then - for _, value in rpairs(events["mouse_drag"][index]) do - if (value.dragHandler ~= nil) then - if (value:dragHandler(button, x, y)) then - focusSystem(self) - return true + if(self:isVisible())and(self:isEnabled())then + if(events["mouse_drag"]~=nil)then + for _, index in ipairs(eventZIndex["mouse_drag"]) do + if (events["mouse_drag"][index] ~= nil) then + for _, value in rpairs(events["mouse_drag"][index]) do + if (value.dragHandler ~= nil) then + if (value:dragHandler(button, x, y)) then + focusSystem(self) + return true + end end end end diff --git a/Basalt/Object.lua b/Basalt/Object.lua index 416e51e..eea0094 100644 --- a/Basalt/Object.lua +++ b/Basalt/Object.lua @@ -56,17 +56,21 @@ return function(name) isVisible = false self:updateDraw() return self - end; + end, enable = function(self) isEnabled = true return self - end; + end, disable = function(self) isEnabled = false return self - end; + end, + + isEnabled = function(self) + return isEnabled + end, generateXMLEventFunction = function(self, func, val) local createF = function(str) diff --git a/Basalt/main.lua b/Basalt/main.lua index 65261b1..28fc5b3 100644 --- a/Basalt/main.lua +++ b/Basalt/main.lua @@ -8,7 +8,7 @@ local createText = utils.createText local baseTerm = term.current() -local version = "1.6.0" +local version = "1.6.1" local debugger = true local projectDirectory = fs.getDir(table.pack(...)[2] or "")