Increase performances

Calls addStyledText only when labels are needed
master
mike-f1 2019-12-05 23:38:36 +01:00
parent 95192675ef
commit ad5032d669
1 changed files with 7 additions and 8 deletions

View File

@ -144,18 +144,17 @@ local function displayOnScreenObjects()
local mainBody = group[2].body
local mainCoords = group[1].screenCoordinates
local count = #group - 1
local label = ""
if should_show_label then
label = mainBody:GetLabel()
if count > 1 then
label = label .. " (" .. count .. ")"
end
end
ui.addIcon(mainCoords, getBodyIcon(mainBody), colors.frame, iconsize, ui.anchor.center, ui.anchor.center)
mainCoords.x = mainCoords.x + label_offset
ui.addStyledText(mainCoords, ui.anchor.left, ui.anchor.center, label , colors.frame, pionillium.small)
if should_show_label then
local label = mainBody:GetLabel()
if count > 1 then
label = label .. " (" .. count .. ")"
end
ui.addStyledText(mainCoords, ui.anchor.left, ui.anchor.center, label , colors.frame, pionillium.small)
end
local mp = ui.getMousePos()
-- mouse release handler for radial menu
if (mp - mainCoords):length() < iconsize:length() * 1.5 then