Skip to content

Commit 3fc2659

Browse files
committed
Make UI dimensions static and clean up TODOs
1 parent 69ed68b commit 3fc2659

File tree

2 files changed

+20
-22
lines changed

2 files changed

+20
-22
lines changed

src/Classes/PassiveSpec.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ function PassiveSpecClass:Load(xml, dbFileName)
131131
weaponSets[tonumber(nodeId)] = weaponSet
132132
end
133133
elseif node.elem == "AutoAttributeConfig" then
134-
-- TODO continue autoAttributeConfig loading
135134
local autoAttributeConfig = { }
136135
if node.attrib then
137136
autoAttributeConfig.enabled = node.attrib.enabled == "true"

src/Classes/TreeTab.lua

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,7 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build)
134134
main:OpenPopup(470, 100, "Reset Tree", controls, nil, "edit", "cancel")
135135
end)
136136

137-
-- Automatic Attribute Allocation Button
138-
-- TODO check if that's where/how I want autoAttribute button positioned
139-
--local updateAutoAttributeConfigAnchor = function(anchor) self.controls.autoAttributeButton:SetAnchor("LEFT", anchor, "RIGHT") end
137+
-- Auto Attribute Config Button
140138
self.controls.autoAttributeButton = new("ButtonControl", { "LEFT", self.controls.reset, "RIGHT" }, { 8, 0, 150, 20 }, "Auto Attribute Config", function() self:ConfigureAutoAttributePopup() end)
141139

142140
-- Tree Version Dropdown
@@ -815,6 +813,8 @@ function TreeTabClass:ConfigureAutoAttributePopup()
815813
end
816814

817815
local controls = { }
816+
local config = copyTable(self.build.spec.autoAttributeConfig)
817+
818818
local function toggleOptions(state)
819819
-- used to disable/enable config fields when main option is set
820820
for key, control in pairs(controls) do
@@ -823,65 +823,64 @@ function TreeTabClass:ConfigureAutoAttributePopup()
823823
end
824824
end
825825
end
826-
826+
827+
-- UI dimensions
827828
-- Main popup window
828829
local window = {
829830
width = 450,
830831
height = 330,
831832
}
832-
local config = copyTable(self.build.spec.autoAttributeConfig)
833-
834-
-- TODO convert all sizes to static values instead?
835-
836833
-- 'save' and 'cancel' buttons
837834
local mainButton = {
838-
y = m_floor(window.height * 0.9),
839-
x = m_floor(window.width * 0.15),
835+
y = 290,
836+
x = 60,
840837
}
838+
-- config settings
841839
local settingsSection = {
842-
width = m_floor(window.width * 0.9),
843-
height = m_floor(window.height * 0.5),
844-
gapTop = m_floor(window.height * 0.25),
845-
marginX = m_floor(window.width * 0.1),
840+
width = 400,
841+
height = 165,
842+
gapTop = 80,
843+
marginX = 45,
846844
marginY = 20,
847845
}
848846
local settingsColumns = {
849847
[1] = {
850848
id = "attribute",
851849
header = "Attribute",
852-
width = m_floor(window.width * 0.25),
850+
width = 110,
853851
height = 16,
854852
},
855853
[2] = {
856854
id = "weight",
857855
header = "Weight",
858-
width = m_floor(window.width * 0.15),
856+
width = 65,
859857
height = 16,
860858
},
861859
[3] = {
862860
id = "maxVal",
863861
header = "Max Value",
864-
width = m_floor(window.width * 0.15),
862+
width = 65,
865863
height = 16,
866864
},
867865
[4] = {
868866
id = "useMaxVal",
869867
header = "Limit to Max?",
870-
width = m_floor(window.width * 0.15),
868+
width = 65,
871869
height = 16,
872870
},
873871
}
874872

873+
-- Actual control elements
875874
-- Main Checkbox
876-
controls.enabledLabel = new("LabelControl", nil, { m_floor(-window.width * 0.2), m_floor(window.height * 0.10), m_floor(window.width * 0.3), 16 }, "^7Automatic Attribute Allocation")
875+
controls.enabledLabel = new("LabelControl", nil, { -90, 35, 135, 16 }, "^7Automatic Attribute Allocation")
877876
controls.enabledCheck = new("CheckBoxControl", { "LEFT", controls.enabledLabel, "RIGHT" }, { 10, 0, 18 }, "",
878877
function(value)
879878
config.enabled = value
880879
toggleOptions(value)
881880
end, "^7Enabling this option will automatically decide which attribute to allocate on travel nodes, \naccording to the configured weights and current total attributes", config.enabled)
882881

883-
-- Section for detail setting
884-
-- Headers
882+
-- Section for config settings
883+
-- Header columns
885884
controls.settingsSection = new("SectionControl", nil, { 0, settingsSection.gapTop, settingsSection.width, settingsSection.height }, "^7Allocation Settings")
886885
for i, column in ipairs(settingsColumns) do
887886
local anchor = i == 1 and { "TOPLEFT", controls.settingsSection, "TOPLEFT" } or {"LEFT", controls[settingsColumns[i-1].id .. "Label"], "RIGHT" }

0 commit comments

Comments
 (0)