diff --git a/Basalt/Frame.lua b/Basalt/Frame.lua index 49198aa..7b5ea76 100644 --- a/Basalt/Frame.lua +++ b/Basalt/Frame.lua @@ -1,9 +1,10 @@ +local module = require("module") local Object = require("Object") local _OBJECTS = require("loadObjects") local BasaltDraw = require("basaltDraw") local utils = require("utils") -local layout = require("layout") -local basaltMon = require("basaltMon") +local layout = module("layout") +local basaltMon = module("basaltMon") local uuid = utils.uuid local rpairs = utils.rpairs local xmlValue = utils.getValueFromXML @@ -523,7 +524,7 @@ return function(name, parent, pTerm, basalt) getScrollAmount = function(self) - return autoScroll and scrollAmount or calculateMaxScroll(self) + return autoScroll and calculateMaxScroll(self) or scrollAmount end, show = function(self) @@ -728,14 +729,14 @@ return function(name, parent, pTerm, basalt) if(focusedObject~=nil)then focusedObject:getFocusHandler() end end; - eventHandler = function(self, event, p1, p2, p3, p4) - base.eventHandler(self, event, p1, p2, p3, p4) + eventHandler = function(self, event, ...) + base.eventHandler(self, event, ...) if(events["other_event"]~=nil)then for _, index in ipairs(eventZIndex["other_event"]) do if (events["other_event"][index] ~= nil) then for _, value in rpairs(events["other_event"][index]) do if (value.eventHandler ~= nil) then - if (value:eventHandler(event, p1, p2, p3, p4)) then + if (value:eventHandler(event, ...)) then return true end end diff --git a/Basalt/libraries/images.lua b/Basalt/libraries/images.lua index 6f02dda..002b389 100644 --- a/Basalt/libraries/images.lua +++ b/Basalt/libraries/images.lua @@ -28,7 +28,6 @@ end local function resizeBIMG(source, w, h) local oW, oH = #source[1][1][1], #source[1] - local xRatio, yRatio = oW / w, oH / h local newImg = {{}} for k,v in pairs(source)do if(k~=1)then newImg[k] = v end end local img = source[1] diff --git a/Basalt/module.lua b/Basalt/module.lua new file mode 100644 index 0000000..75f39cf --- /dev/null +++ b/Basalt/module.lua @@ -0,0 +1,4 @@ +return function(path) + local exists, content = pcall(require, path) + return exists and content or nil +end \ No newline at end of file diff --git a/Basalt/objects/Label.lua b/Basalt/objects/Label.lua index 433beb5..0e9afba 100644 --- a/Basalt/objects/Label.lua +++ b/Basalt/objects/Label.lua @@ -144,9 +144,9 @@ return function(name) oby = oby or math.floor((oY - cY) / 2) + 1 for i = 1, cY do - self.parent:setFG(obx, oby + i - 2, tData[2][i]) - self.parent:setBG(obx, oby + i - 2, tData[3][i]) - self.parent:setText(obx, oby + i - 2, tData[1][i]) + self.parent:setFG(obx, oby + i - 1, tData[2][i]) + self.parent:setBG(obx, oby + i - 1, tData[3][i]) + self.parent:setText(obx, oby + i - 1, tData[1][i]) end end end diff --git a/Basalt/objects/Textfield.lua b/Basalt/objects/Textfield.lua index 2516e01..d42c354 100644 --- a/Basalt/objects/Textfield.lua +++ b/Basalt/objects/Textfield.lua @@ -144,6 +144,7 @@ return function(name) editLine = function(self, index, text) lines[index] = text or lines[index] + updateColors(self, index) self:updateDraw() return self end; @@ -163,18 +164,20 @@ return function(name) lines[1] = text bgLines[1] = tHex[self.bgColor]:rep(text:len()) fgLines[1] = tHex[self.fgColor]:rep(text:len()) + updateColors(self, 1) return self end if (index ~= nil) then table.insert(lines, index, text) table.insert(bgLines, index, tHex[self.bgColor]:rep(text:len())) - table.insert(fgLines, tHex[self.fgColor]:rep(text:len())) + table.insert(fgLines, index, tHex[self.fgColor]:rep(text:len())) else table.insert(lines, text) table.insert(bgLines, tHex[self.bgColor]:rep(text:len())) table.insert(fgLines, tHex[self.fgColor]:rep(text:len())) end end + updateColors(self, index or #lines) self:updateDraw() return self end;