mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
much faster layout calculation
This commit is contained in:
@@ -15,14 +15,16 @@ function Console.onLog(level, message, time)
|
||||
if level == LogDebug then
|
||||
color = '#5555ff'
|
||||
elseif level == LogInfo then
|
||||
color = '#55ff55'
|
||||
color = '#5555ff'
|
||||
elseif level == LogWarning then
|
||||
color = '#ffff00'
|
||||
else
|
||||
color = '#ff0000'
|
||||
end
|
||||
|
||||
Console.addLine(message, color)
|
||||
if level ~= LogDebug then
|
||||
Console.addLine(message, color)
|
||||
end
|
||||
|
||||
logLocked = false
|
||||
end
|
||||
@@ -35,12 +37,17 @@ function Console.addLine(text, color)
|
||||
label:setStyle('ConsoleLabel')
|
||||
label:setText(text)
|
||||
label:setForegroundColor(color)
|
||||
console:insertChild(label, -1)
|
||||
console:insertChild(3, label)
|
||||
|
||||
local lastLabel = console:getChildByIndex(4)
|
||||
if lastLabel then
|
||||
lastLabel:addAnchor(AnchorBottom, "prev", AnchorTop)
|
||||
end
|
||||
|
||||
numLines = numLines + 1
|
||||
if numLines > maxLines then
|
||||
local firstLine = console:getChildByIndex(0)
|
||||
firstLine:destroy()
|
||||
local firstLabel = console:getChildByIndex(-1)
|
||||
firstLabel:destroy()
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
ConsoleLabel < UILabel
|
||||
font: terminus-14px-bold
|
||||
height: 16
|
||||
anchors.bottom: next.top
|
||||
anchors.bottom: commandBox.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
margin.left: 2
|
||||
@@ -13,6 +13,7 @@ RectPanel
|
||||
anchors.fill: parent
|
||||
|
||||
UILabel
|
||||
id: commandSymbolLabel
|
||||
size: 18 20
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
@@ -32,4 +33,4 @@ RectPanel
|
||||
function(self)
|
||||
Console.executeCommand(self:getText())
|
||||
self:clearText()
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user