Skip to content

Commit c131e81

Browse files
committed
improve spacings/positions of inputs
1 parent 9298545 commit c131e81

3 files changed

Lines changed: 47 additions & 37 deletions

File tree

src/Classes/CompareBuySimilar.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ function M.openPopup(item, slotName, primaryBuild)
180180
local rowHeight = 24
181181
local popupWidth = 700
182182
local leftMargin = 20
183-
local minFieldX = popupWidth - 160
184-
local maxFieldX = popupWidth - 80
183+
local minFieldX = popupWidth - 130
184+
local maxFieldX = popupWidth - 50
185185
local fieldW = 60
186186
local fieldH = 20
187187
local checkboxSize = 20
@@ -291,10 +291,10 @@ function M.openPopup(item, slotName, primaryBuild)
291291
controls.leagueDrop.enabled = function() return #controls.leagueDrop.list > 0 and controls.leagueDrop.list[1] ~= "Loading..." end
292292

293293
-- Listed status dropdown
294-
controls.listedLabel = new("LabelControl", {"LEFT", controls.leagueDrop, "RIGHT"}, {12, 0, 0, 16}, "^7Listed:")
295-
controls.listedDrop = new("DropDownControl", {"LEFT", controls.listedLabel, "RIGHT"}, {4, 0, 180, 20}, LISTED_STATUS_LABELS, function(index, value)
294+
controls.listedDrop = new("DropDownControl", {"TOPRIGHT", nil, "TOPRIGHT"}, {-leftMargin, ctrlY, 242, 20}, LISTED_STATUS_LABELS, function(index, value)
296295
-- Listed status selection stored in the dropdown itself
297296
end)
297+
controls.listedLabel = new("LabelControl", {"RIGHT", controls.listedDrop, "LEFT"}, {-4, 0, 0, 16}, "^7Listed:")
298298

299299
-- Fetch initial leagues for default realm
300300
fetchLeaguesForRealm("pc")
@@ -361,7 +361,7 @@ function M.openPopup(item, slotName, primaryBuild)
361361

362362
-- Search button
363363
ctrlY = ctrlY + 8
364-
controls.search = new("ButtonControl", nil, {0, ctrlY, 100, 20}, "Generate URL", function()
364+
controls.search = new("ButtonControl", nil, {0, ctrlY, 110, 20}, "Generate URL", function()
365365
local success, result = pcall(function()
366366
return buildURL(item, slotName, controls, modEntries, defenceEntries, isUnique)
367367
end)

src/Classes/CompareTab.lua

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ local LAYOUT = {
3636
-- Items view
3737
itemsCheckboxOffset = 60,
3838
itemsCopyBtnW = 60,
39+
itemsCopyUseBtnW = 78,
3940
itemsCopyBtnH = 18,
4041
itemsBuyBtnW = 60,
4142

@@ -211,7 +212,7 @@ function CompareTabClass:InitControls()
211212
end)
212213

213214
-- Re-import current build button
214-
self.controls.reimportBtn = new("ButtonControl", {"LEFT", self.controls.importBtn, "RIGHT"}, {4, 0, 120, 20}, "Re-import Current", function()
215+
self.controls.reimportBtn = new("ButtonControl", {"LEFT", self.controls.importBtn, "RIGHT"}, {4, 0, 140, 20}, "Re-import Current", function()
215216
self:ReimportPrimary()
216217
end)
217218
self.controls.reimportBtn.tooltipFunc = function(tooltip)
@@ -850,7 +851,7 @@ function CompareTabClass:InitControls()
850851
self.controls.rightVersionSelect.shown = treeFooterShown
851852

852853
-- Copy compared tree to primary build
853-
self.controls.copySpecBtn = new("ButtonControl", {"LEFT", self.controls.rightVersionSelect, "RIGHT"}, {4, 0, 66, 20}, "Copy tree", function()
854+
self.controls.copySpecBtn = new("ButtonControl", {"LEFT", self.controls.rightVersionSelect, "RIGHT"}, {4, 0, 76, 20}, "Copy tree", function()
854855
self:CopyCompareSpecToPrimary(false)
855856
end)
856857
self.controls.copySpecBtn.shown = treeFooterShown
@@ -859,7 +860,7 @@ function CompareTabClass:InitControls()
859860
return entry and entry.treeTab and entry.treeTab.specList[entry.treeTab.activeSpec] ~= nil
860861
end
861862

862-
self.controls.copySpecUseBtn = new("ButtonControl", {"LEFT", self.controls.copySpecBtn, "RIGHT"}, {2, 0, 90, 20}, "Copy and use", function()
863+
self.controls.copySpecUseBtn = new("ButtonControl", {"LEFT", self.controls.copySpecBtn, "RIGHT"}, {2, 0, 100, 20}, "Copy and use", function()
863864
self:CopyCompareSpecToPrimary(true)
864865
end)
865866
self.controls.copySpecUseBtn.shown = treeFooterShown
@@ -3586,7 +3587,7 @@ function CompareTabClass:DrawItems(vp, compareEntry, inputEvents)
35863587
DrawString(colWidth - 10, drawY, "RIGHT", 14, "VAR", tradeHelpers.getSlotDiffLabel(pItem, cItem))
35873588

35883589
if cItem then
3589-
local b1Hover, b2Hover, b3Hover, b2X, b2Y, b2W, b2H = tradeHelpers.drawCopyButtons(cursorX, cursorY, vp.width - 196, drawY + 1, slotMissing, LAYOUT.itemsCopyBtnW, LAYOUT.itemsCopyBtnH, LAYOUT.itemsBuyBtnW)
3590+
local b1Hover, b2Hover, b3Hover, b2X, b2Y, b2W, b2H = tradeHelpers.drawCopyButtons(cursorX, cursorY, vp.width - 214, drawY + 1, slotMissing, LAYOUT.itemsCopyBtnW, LAYOUT.itemsCopyBtnH, LAYOUT.itemsBuyBtnW, LAYOUT.itemsCopyUseBtnW)
35903591
processSlotButtons(b1Hover, b2Hover, b3Hover, b2X, b2Y, b2W, b2H, cItem, copySlotName, copyUseSlotName)
35913592
end
35923593

@@ -3610,7 +3611,7 @@ function CompareTabClass:DrawItems(vp, compareEntry, inputEvents)
36103611
tradeHelpers.drawCompactSlotRow(drawY, label, pItem, cItem,
36113612
colWidth, cursorX, cursorY, labelW,
36123613
self.primaryBuild.itemsTab, compareEntry.itemsTab, pWarn, cWarn, slotMissing,
3613-
LAYOUT.itemsCopyBtnW, LAYOUT.itemsCopyBtnH, LAYOUT.itemsBuyBtnW)
3614+
LAYOUT.itemsCopyBtnW, LAYOUT.itemsCopyBtnH, LAYOUT.itemsBuyBtnW, LAYOUT.itemsCopyUseBtnW)
36143615

36153616
if rowHoverItem then
36163617
hoverItem = rowHoverItem

src/Classes/CompareTradeHelpers.lua

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -236,53 +236,62 @@ end
236236
-- btnStartX is the left edge where the first button (Buy) should appear.
237237
-- copyBtnW, copyBtnH, buyBtnW are button dimensions (passed from LAYOUT by caller).
238238
-- Returns copyHovered, copyUseHovered, buyHovered booleans.
239-
function M.drawCopyButtons(cursorX, cursorY, btnStartX, btnY, slotMissing, copyBtnW, copyBtnH, buyBtnW)
240-
local btnW = copyBtnW
241-
local btnH = copyBtnH
242-
local buyW = buyBtnW
239+
function M.drawCopyButtons(cursorX, cursorY, btnStartX, btnY, slotMissing, copyBtnW, copyBtnH, buyBtnW, copyUseBtnW)
240+
local btnW = copyBtnW
241+
local btnH = copyBtnH
242+
local buyW = buyBtnW
243+
local copyUseW = copyUseBtnW
243244
local btn3X = btnStartX
244245
local btn1X = btn3X + buyW + 4
245246
local btn2X = btn1X + btnW + 4
246247

248+
local function drawBtn(x, w, hover, label)
249+
local pressed = hover and IsKeyDown("LEFTBUTTON")
250+
-- Outer border
251+
if hover then
252+
SetDrawColor(1, 1, 1)
253+
else
254+
SetDrawColor(0.5, 0.5, 0.5)
255+
end
256+
DrawImage(nil, x, btnY, w, btnH)
257+
-- Inner fill
258+
if pressed then
259+
SetDrawColor(0.5, 0.5, 0.5)
260+
elseif hover then
261+
SetDrawColor(0.33, 0.33, 0.33)
262+
else
263+
SetDrawColor(0, 0, 0)
264+
end
265+
DrawImage(nil, x + 1, btnY + 1, w - 2, btnH - 2)
266+
-- Label
267+
SetDrawColor(1, 1, 1)
268+
DrawString(x + w / 2, btnY + 1, "CENTER_X", 14, "VAR", label)
269+
end
270+
247271
-- "Buy" button
248272
local b3Hover = cursorX >= btn3X and cursorX < btn3X + buyW
249273
and cursorY >= btnY and cursorY < btnY + btnH
250-
SetDrawColor(b3Hover and 0.5 or 0.35, b3Hover and 0.5 or 0.35, b3Hover and 0.5 or 0.35)
251-
DrawImage(nil, btn3X, btnY, buyW, btnH)
252-
SetDrawColor(0.1, 0.1, 0.1)
253-
DrawImage(nil, btn3X + 1, btnY + 1, buyW - 2, btnH - 2)
254-
SetDrawColor(1, 1, 1)
255-
DrawString(btn3X + buyW / 2, btnY + 1, "CENTER_X", 14, "VAR", "^7Buy")
274+
drawBtn(btn3X, buyW, b3Hover, "^7Buy")
256275

257276
-- "Copy" button
258277
local b1Hover = cursorX >= btn1X and cursorX < btn1X + btnW
259278
and cursorY >= btnY and cursorY < btnY + btnH
260-
SetDrawColor(b1Hover and 0.5 or 0.35, b1Hover and 0.5 or 0.35, b1Hover and 0.5 or 0.35)
261-
DrawImage(nil, btn1X, btnY, btnW, btnH)
262-
SetDrawColor(0.1, 0.1, 0.1)
263-
DrawImage(nil, btn1X + 1, btnY + 1, btnW - 2, btnH - 2)
264-
SetDrawColor(1, 1, 1)
265-
DrawString(btn1X + btnW / 2, btnY + 1, "CENTER_X", 14, "VAR", "^7Copy")
279+
drawBtn(btn1X, btnW, b1Hover, "^7Copy")
266280

267281
local b2Hover
268282
if slotMissing then
269283
-- Show "Missing slot" label instead of Copy+Use button
270284
SetDrawColor(1, 1, 1)
271-
DrawString(btn2X + btnW / 2, btnY + 1, "CENTER_X", 14, "VAR", "^xBBBBBBMissing slot")
285+
DrawString(btn2X + copyUseW / 2, btnY + 1, "CENTER_X", 14, "VAR", "^xBBBBBBMissing slot")
272286
b2Hover = false
273287
else
274288
-- "Copy+Use" button
275-
b2Hover = cursorX >= btn2X and cursorX < btn2X + btnW
289+
b2Hover = cursorX >= btn2X and cursorX < btn2X + copyUseW
276290
and cursorY >= btnY and cursorY < btnY + btnH
277-
SetDrawColor(b2Hover and 0.5 or 0.35, b2Hover and 0.5 or 0.35, b2Hover and 0.5 or 0.35)
278-
DrawImage(nil, btn2X, btnY, btnW, btnH)
279-
SetDrawColor(0.1, 0.1, 0.1)
280-
DrawImage(nil, btn2X + 1, btnY + 1, btnW - 2, btnH - 2)
281-
SetDrawColor(1, 1, 1)
282-
DrawString(btn2X + btnW / 2, btnY + 1, "CENTER_X", 14, "VAR", "^7Copy+Use")
291+
drawBtn(btn2X, copyUseW, b2Hover, "^7Copy+Use")
283292
end
284293

285-
return b1Hover, b2Hover, b3Hover, btn2X, btnY, btnW, btnH
294+
return b1Hover, b2Hover, b3Hover, btn2X, btnY, copyUseW, btnH
286295
end
287296

288297
-- Helper: fit a colored item name within maxW pixels, truncating with "..." if needed.
@@ -311,7 +320,7 @@ local ITEM_BOX_H = 20
311320

312321
function M.drawCompactSlotRow(drawY, slotLabel, pItem, cItem,
313322
colWidth, cursorX, cursorY, maxLabelW, primaryItemsTab, compareItemsTab, pWarn, cWarn, slotMissing,
314-
copyBtnW, copyBtnH, buyBtnW)
323+
copyBtnW, copyBtnH, buyBtnW, copyUseBtnW)
315324

316325
local pName = pItem and pItem.name or "(empty)"
317326
local cName = cItem and cItem.name or "(empty)"
@@ -368,7 +377,7 @@ function M.drawCompactSlotRow(drawY, slotLabel, pItem, cItem,
368377
if cItem then
369378
local btnStartX = cBoxX + cBoxW + 6
370379
b1Hover, b2Hover, b3Hover, b2X, b2Y, b2W, b2H =
371-
M.drawCopyButtons(cursorX, cursorY, btnStartX, drawY + 1, slotMissing, copyBtnW, copyBtnH, buyBtnW)
380+
M.drawCopyButtons(cursorX, cursorY, btnStartX, drawY + 1, slotMissing, copyBtnW, copyBtnH, buyBtnW, copyUseBtnW)
372381
end
373382

374383
-- Determine hovered item and tooltip anchor position

0 commit comments

Comments
 (0)