Skip to content

Commit a79dde4

Browse files
committed
Tweak selections padding.
1 parent 7d63f5d commit a79dde4

2 files changed

Lines changed: 28 additions & 8 deletions

File tree

LuaUI/Widgets/gui_chili_selections_and_cursortip.lua

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ options_order = {
303303

304304
--selected units
305305
'selection_opacity', 'allowclickthrough', 'tooltipThroughPanels', 'groupbehaviour', 'showgroupinfo', 'sortByHealth',
306-
'uniticon_size', 'manualWeaponReloadBar', 'jumpReloadBar', 'selectionScale',
306+
'uniticon_size', 'matchIconSizes', 'manualWeaponReloadBar', 'jumpReloadBar', 'selectionScale',
307307
'fancySkinning', 'leftPadding',
308308
}
309309

@@ -456,8 +456,17 @@ options = {
456456
if selectionWindow then
457457
selectionWindow.SetSelectionIconSize(self.value)
458458
end
459+
ResetWindows()
459460
end,
460461
},
462+
matchIconSizes = {
463+
name="Match Icon Sizes",
464+
type='bool',
465+
value= true,
466+
desc = "Match single selection and tooltip icon size to multi-selection icon size.",
467+
path = selPath,
468+
OnChange = ResetWindows
469+
},
461470
manualWeaponReloadBar = {
462471
name="Show Unit's Special Weapon Status",
463472
type='bool',
@@ -1502,15 +1511,19 @@ end
15021511
--------------------------------------------------------------------------------
15031512
-- Group buttons window
15041513

1514+
local function GetMultiIconScale()
1515+
local width = options.uniticon_size.value - 2 -- Parent padding
1516+
local height = math.floor(options.uniticon_size.value * 0.79 + 0.5)
1517+
return width, height
1518+
end
1519+
15051520
local function GetUnitGroupIconButton(parentControl)
1506-
15071521
local unitDefID
15081522
local unitID
15091523
local unitList
15101524
local unitCount
15111525
local unitpicBadgeUpdate
15121526
local healthProp
1513-
15141527
local size = options.uniticon_size.value
15151528

15161529
local holder = Chili.Control:New{
@@ -1535,12 +1548,13 @@ local function GetUnitGroupIconButton(parentControl)
15351548
parent = holder
15361549
}
15371550

1551+
local imageWidth, imageHeight = GetMultiIconScale()
15381552
local unitImage = Chili.Image:New{
15391553
keepAspect = false,
15401554
x = 0,
15411555
y = 0,
1542-
right = 0,
1543-
bottom = "20%",
1556+
width = imageWidth,
1557+
height = imageHeight,
15441558
padding = {0,0,0,0},
15451559
parent = holder,
15461560
OnClick = {
@@ -2040,7 +2054,7 @@ end
20402054
local function GetSingleUnitInfoPanel(parentControl, isTooltipVersion)
20412055
local selectedUnitID
20422056
local scale = isTooltipVersion and options.tooltipScale.value or options.selectionScale.value
2043-
local leftWidth = math.floor(LEFT_WIDTH * scale + 0.5)
2057+
local leftWidth = math.floor((LEFT_WIDTH - 2) * scale + 2 + 0.5)
20442058
local rightWidth = math.floor(RIGHT_WIDTH * scale + 0.5)
20452059
local picHeight = math.floor(PIC_HEIGHT * scale + 0.5)
20462060
local fontSize = math.floor(IMAGE_FONT * scale + 0.5)
@@ -2050,6 +2064,10 @@ local function GetSingleUnitInfoPanel(parentControl, isTooltipVersion)
20502064
local barSpacing = math.floor(BAR_SPACING * scale + 0.5)
20512065
local leftSpacing = math.floor(LEFT_SPACE * scale + 0.5)
20522066

2067+
if options.matchIconSizes.value then
2068+
leftWidth, picHeight = GetMultiIconScale()
2069+
end
2070+
20532071
local leftPanel = Chili.Control:New{
20542072
name = "leftPanel",
20552073
x = 0,
@@ -2844,7 +2862,6 @@ local function GetSelectionWindow()
28442862
noClickThrough = not options.allowclickthrough.value,
28452863
parent = holderWindow
28462864
}
2847-
mainPanel.padding[1] = mainPanel.padding[1] + options.leftPadding.value
28482865
mainPanel:Hide()
28492866

28502867
local singleUnitDisplay = GetSingleUnitInfoPanel(mainPanel, false)
@@ -2913,6 +2930,8 @@ local function GetSelectionWindow()
29132930

29142931
function externalFunctions.SetSkin(className)
29152932
SetPanelSkin(mainPanel, className)
2933+
mainPanel.padding[2] = 14
2934+
mainPanel:Invalidate()
29162935
end
29172936

29182937
function externalFunctions.SetLeftPadding(padding)

LuaUI/Widgets/gui_hud_presets.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ end
188188
local function GetSelectionIconSize(height)
189189
local rows = math.floor((height - 25)/50)
190190
local size = math.floor((height - 25)/rows)
191-
local iconHeight = math.floor((math.min(53, size) + 4) * (options.bottomPanelScale.value or 1) + 0.5)
191+
local scale = (options.bottomPanelScale.value or 1)
192+
local iconHeight = math.floor((math.min(53, size) + 4) * scale + (scale - 1)*10 + 0.5)
192193
return iconHeight
193194
end
194195

0 commit comments

Comments
 (0)