Small changes
- Added module(path) - Fixed addLine and editLine not updating the colors - Fixed wrong bigfont position
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
4
Basalt/module.lua
Normal file
4
Basalt/module.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
return function(path)
|
||||
local exists, content = pcall(require, path)
|
||||
return exists and content or nil
|
||||
end
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user