some smaller changes

This commit is contained in:
Robert Jelic
2022-05-19 22:50:34 +02:00
parent ed1f32bbf9
commit 4f20ede76a
5 changed files with 26 additions and 25 deletions

View File

@@ -7,7 +7,6 @@ local requiredFiles = {
"Frame.lua",
"Object.lua",
"defaultTheme.lua",
"minify.lua",
"lib/drawHelper.lua",
"lib/eventSystem.lua",
"lib/process.lua",

View File

@@ -1,22 +1,3 @@
local tHex = { -- copy paste is a very important feature
[colors.white] = "0",
[colors.orange] = "1",
[colors.magenta] = "2",
[colors.lightBlue] = "3",
[colors.yellow] = "4",
[colors.lime] = "5",
[colors.pink] = "6",
[colors.gray] = "7",
[colors.lightGray] = "8",
[colors.cyan] = "9",
[colors.purple] = "a",
[colors.blue] = "b",
[colors.brown] = "c",
[colors.green] = "d",
[colors.red] = "e",
[colors.black] = "f",
}
local function getTextHorizontalAlign(text, width, textAlign)
text = string.sub(text, 1, width)
local offset = width - string.len(text)

View File

@@ -4,4 +4,23 @@ local frames = {}
local keyModifier = {}
local parentTerminal = term.current()
local sub = string.sub
local sub = string.sub
local tHex = { -- copy paste is a very important feature
[colors.white] = "0",
[colors.orange] = "1",
[colors.magenta] = "2",
[colors.lightBlue] = "3",
[colors.yellow] = "4",
[colors.lime] = "5",
[colors.pink] = "6",
[colors.gray] = "7",
[colors.lightGray] = "8",
[colors.cyan] = "9",
[colors.purple] = "a",
[colors.blue] = "b",
[colors.brown] = "c",
[colors.green] = "d",
[colors.red] = "e",
[colors.black] = "f",
}

View File

@@ -146,7 +146,7 @@ local function Image(name)
return self
end;
shrinkImage = function(self)
shrink = function(self)
shrink()
imageGotShrinked = true
return self

View File

@@ -21,8 +21,8 @@ local function Label(name)
return self
end;
setSize = function(self, width, h)
self.width, self.height = width, h
setSize = function(self, width, height)
self.width, self.height = width, height
autoWidth = false
return self
end;
@@ -31,7 +31,9 @@ local function Label(name)
if (base.draw(self)) then
if (self.parent ~= nil) then
local obx, oby = self:getAnchorPosition()
self.parent:writeText(obx, oby, self:getValue(), self.bgColor, self.fgColor)
self.parent:setBackground(obx, oby, self.width, self.height, self.bgColor)
self.parent:setForeground(obx, oby, self.width, self.height, self.fgColor)
self.parent:writeText(obx, oby, self:getValue():sub(1, self.width), self.bgColor, self.fgColor)
end
end
end;