diff --git a/UI.lua b/UI.lua index 9dc091b..b3235e9 100755 --- a/UI.lua +++ b/UI.lua @@ -6,12 +6,16 @@ AltSystem = AltSystem or {} local WINDOW_WIDTH = 700 -local WINDOW_HEIGHT = 500 -local CONTROLS_WIDTH = 350 -local LOG_WIDTH = 350 +local WINDOW_HEIGHT = 520 +local CONTROLS_WIDTH = 360 +local LOG_WIDTH = 340 local PADDING = 12 +local PADDING_HEADER = 6 local ROW_HEIGHT = 26 -local SECTION_GAP = 10 +local LABEL_HEIGHT = 14 -- approximate height of GameFontNormal text +local LABEL_GAP = 4 -- gap between a sub-label and its input +local ITEM_GAP = 10 -- gap between inputs within the same section +local SECTION_GAP = 22 -- gap between major sections -- Helper: Build the skill option list from current AltSystem.Data.Skills local function BuildSkillOptions() @@ -29,26 +33,32 @@ local function BuildSkillOptions() return options end --- Helper: Create a flat dark dropdown with optional label (reuses shared CreateFlatDropdown) +-- Helper: Create a flat dark dropdown with label on top (reuses shared CreateFlatDropdown) local function CreateDropdown(parent, name, labelText, options, defaultIndex, onSelect, labelFont) + local hasLabel = labelText and labelText ~= "" + local containerHeight = hasLabel and (LABEL_HEIGHT + LABEL_GAP + 28) or ROW_HEIGHT + local container = CreateFrame("Frame", nil, parent) - container:SetHeight(ROW_HEIGHT) + container:SetHeight(containerHeight) local label - if labelText and labelText ~= "" then + if hasLabel then label = container:CreateFontString(nil, "OVERLAY", labelFont or "GameFontNormal") - label:SetPoint("LEFT", container, "LEFT", 0, 0) + label:SetPoint("TOPLEFT", container, "TOPLEFT", 0, 0) label:SetText(labelText) label:SetJustifyH("LEFT") + label:SetTextColor(0.9, 0.75, 0.2) end local selectedIndex = defaultIndex or 1 local dropdown = AltSystem.CreateFlatDropdown(name, container, 190) - if label then - dropdown:SetPoint("RIGHT", container, "RIGHT", 0, 0) + if hasLabel then + dropdown:SetPoint("TOPLEFT", container, "TOPLEFT", 0, -(LABEL_HEIGHT + LABEL_GAP)) + dropdown:SetPoint("TOPRIGHT", container, "TOPRIGHT", 0, -(LABEL_HEIGHT + LABEL_GAP)) else dropdown:SetPoint("LEFT", container, "LEFT", 0, 0) + dropdown:SetPoint("RIGHT", container, "RIGHT", 0, 0) end -- Set initial label text @@ -260,12 +270,12 @@ function AltSystem:CreateMainFrame() local yPos = -PADDING -- Section: Define Your Base Roll - CreateSectionHeader(content, "Define Your Base Roll", PADDING, yPos) - yPos = yPos - 25 + CreateSectionHeader(content, "Base Roll", PADDING_HEADER, yPos) + yPos = yPos - 26 -- Roll Type label CreateSubLabel(content, "Roll Type", PADDING, yPos) - yPos = yPos - 20 + yPos = yPos - (LABEL_HEIGHT + LABEL_GAP) -- Roll Type radio buttons local attackRadio, defenseRadio @@ -295,7 +305,7 @@ function AltSystem:CreateMainFrame() UpdateRollTypeSelection("defense") end) - yPos = yPos - ROW_HEIGHT - SECTION_GAP + yPos = yPos - ROW_HEIGHT - ITEM_GAP -- Skill dropdown local skillOptions = BuildSkillOptions() @@ -351,11 +361,11 @@ function AltSystem:CreateMainFrame() AltSystem.SetSkillIndex = setSkillIndex AltSystem.UpdateSkillWarning = UpdateSkillWarning - yPos = yPos - ROW_HEIGHT - SECTION_GAP + yPos = yPos - (LABEL_HEIGHT + LABEL_GAP + 28) - ITEM_GAP -- Armor label CreateSubLabel(content, "Extra Armor", PADDING, yPos) - yPos = yPos - 20 + yPos = yPos - (LABEL_HEIGHT + LABEL_GAP) -- Armor radio buttons local armorRadios = {} @@ -386,8 +396,8 @@ function AltSystem:CreateMainFrame() yPos = yPos - ROW_HEIGHT - SECTION_GAP -- Section: Modifiers (optional) - CreateSectionHeader(content, "Modifiers (optional)", PADDING, yPos) - yPos = yPos - 28 + CreateSectionHeader(content, "Modifiers (optional)", PADDING_HEADER, yPos) + yPos = yPos - 26 --CreateSubLabel(content, "Label", PADDING, yPos) --yPos = yPos - 22 @@ -463,11 +473,11 @@ function AltSystem:CreateMainFrame() UpdatePetVisual() end) - yPos = yPos - ROW_HEIGHT - SECTION_GAP + yPos = yPos - ROW_HEIGHT - ITEM_GAP -- Item label CreateSubLabel(content, "Item", PADDING, yPos) - yPos = yPos - 20 + yPos = yPos - (LABEL_HEIGHT + LABEL_GAP) -- Item radio buttons local itemRadios = {} @@ -498,8 +508,8 @@ function AltSystem:CreateMainFrame() yPos = yPos - ROW_HEIGHT - SECTION_GAP -- Section: Roll Dice - CreateSectionHeader(content, "Roll Dice", PADDING, yPos) - yPos = yPos - 22 + CreateSectionHeader(content, "Roll Mode", PADDING_HEADER, yPos) + yPos = yPos - 26 -- Announce Roll dropdown (Self Roll + channels) local announceOptions = { { text = "Self Roll" } } @@ -524,7 +534,7 @@ function AltSystem:CreateMainFrame() announceContainer:SetPoint("TOPLEFT", content, "TOPLEFT", PADDING, yPos) announceContainer:SetWidth(CONTROLS_WIDTH - PADDING * 2) - yPos = yPos - ROW_HEIGHT - SECTION_GAP + yPos = yPos - (LABEL_HEIGHT + LABEL_GAP + 28) - ITEM_GAP -- Roll button local rollLabel = AltSystem.State.rollType == "attack" and "Roll Attack" or "Roll Defense" @@ -545,7 +555,7 @@ function AltSystem:CreateMainFrame() logPanel:SetSize(LOG_WIDTH, tabContentHeight) -- Log header - local logHeader = CreateSectionHeader(logPanel, "Log", PADDING, -PADDING) + local logHeader = CreateSectionHeader(logPanel, "Log", 0, -PADDING) -- Log scroll area background local logBg = CreateFrame("Frame", nil, logPanel, "InsetFrameTemplate") diff --git a/docs/roll_tab_design.png b/docs/roll_tab_design.png old mode 100755 new mode 100644 index 3ebb626..c80f5dc Binary files a/docs/roll_tab_design.png and b/docs/roll_tab_design.png differ