This commit is contained in:
Robert Jelic
2022-11-23 17:11:33 +01:00
4 changed files with 27 additions and 10 deletions

View File

@@ -371,7 +371,17 @@ return function(name, parent, pTerm, basalt)
getType = function(self)
return objectType
end;
end,
setZIndex = function(self, newIndex)
base.setZIndex(self, newIndex)
for k,v in pairs(activeEvents)do
if(v)then
self.parent:addEvent(k, self)
end
end
return self
end,
setFocusedObject = function(self, obj)
if(focusedObject~=obj)then

View File

@@ -909,7 +909,6 @@ return function(name)
eventHandler = function(self, event, p1, p2, p3, p4)
local val = eventSystem:sendEvent("other_event", self, event, p1, p2, p3, p4)
if(val~=nil)then return val end
return true
end;
getFocusHandler = function(self)
@@ -944,4 +943,4 @@ return function(name)
object.__index = object
return object
end
end

View File

@@ -1,10 +1,17 @@
local curDir = fs.getDir(table.pack(...)[2]) or ""
local defaultPath = package.path
local format = "%s;/%s/?.lua;/%s/?/init.lua"
package.path = string.format(format, package.path, curDir,curDir)..string.format(format, package.path, curDir.."/libraries",curDir.."/libraries")..string.format(format, package.path, curDir.."/objects",curDir.."/objects")
if not(packed)then
local defaultPath = package.path
local format = "path;/path/?.lua;/path/?/init.lua;"
local main = format:gsub("path", curDir)
local objFolder = format:gsub("path", curDir.."/objects")
local libFolder = format:gsub("path", curDir.."/libraries")
package.path = main..objFolder..libFolder..defaultPath
end
local Basalt = require("main")
package.path = defaultPath
return Basalt
return Basalt

View File

@@ -60,8 +60,9 @@ return function(name)
for n = 1, h do
if (n == verticalAlign) then
self.parent:setText(obx, oby + (n - 1), utils.getTextHorizontalAlign(self:getValue(), w, textHorizontalAlign))
self.parent:setFG(obx, oby + (n - 1), utils.getTextHorizontalAlign(tHex[self.fgColor]:rep(self:getValue():len()), w, textHorizontalAlign))
local val = self:getValue()
self.parent:setText(obx + (w/2-val:len()/2), oby + (n - 1), utils.getTextHorizontalAlign(val, val:len(), textHorizontalAlign))
self.parent:setFG(obx + (w/2-val:len()/2), oby + (n - 1), utils.getTextHorizontalAlign(tHex[self.fgColor]:rep(val:len()), val:len(), textHorizontalAlign))
end
end
end
@@ -70,4 +71,4 @@ return function(name)
}
return setmetatable(object, base)
end
end