@@ -119,9 +119,29 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin
119119 self :CloseBuild ()
120120 end
121121 end )
122- self .controls .buildName = new (" Control" , {" LEFT" ,self .controls .back ," RIGHT" }, {8 , 0 , 0 , 20 })
122+ self .controls .save = new (" ButtonControl" , {" LEFT" ,self .controls .back ," RIGHT" }, {8 , 0 , 50 , 20 }, " Save" , function ()
123+ self :SaveDBFile ()
124+ end )
125+ self .controls .save .enabled = function ()
126+ return not self .dbFileName or self .unsaved
127+ end
128+ self .controls .saveAs = new (" ButtonControl" , {" LEFT" ,self .controls .save ," RIGHT" }, {8 , 0 , 70 , 20 }, " Save As" , function ()
129+ self :OpenSaveAsPopup ()
130+ end )
131+ self .controls .saveAs .enabled = function ()
132+ return self .dbFileName
133+ end
134+
135+ -- conditional for smaller screens to move "Current build" to the side bar
136+ local function buildNameConditional ()
137+ return self .anchorTopBarRight :GetPos () < 800
138+ end
139+ self .controls .buildName = new (" Control" , {" LEFT" ,self .controls .saveAs ," RIGHT" }, {4 , 36 , 0 , 20 })
123140 self .controls .buildName .width = function (control )
124- local limit = self .anchorTopBarRight :GetPos () - 98 - 40 - self .controls .back :GetSize () - self .controls .save :GetSize () - self .controls .saveAs :GetSize ()
141+ local limit = buildNameConditional () and 203 or
142+ (self .anchorTopBarRight :GetPos () - 98 - 62
143+ - self .controls .pointDisplay :GetSize () - self .controls .levelScalingButton :GetSize () - self .controls .characterLevel :GetSize ()
144+ - self .controls .back :GetSize () - self .controls .save :GetSize () - self .controls .saveAs :GetSize ())
125145 local bnw = DrawStringWidth (16 , " VAR" , self .buildName )
126146 self .strWidth = m_min (bnw , limit )
127147 self .strLimited = bnw > limit
@@ -150,30 +170,20 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin
150170 SetDrawLayer (nil , 0 )
151171 end
152172 end
153- self .controls .save = new (" ButtonControl" , {" LEFT" ,self .controls .buildName ," RIGHT" }, {8 , 0 , 50 , 20 }, " Save" , function ()
154- self :SaveDBFile ()
155- end )
156- self .controls .save .enabled = function ()
157- return not self .dbFileName or self .unsaved
173+ self .controls .buildName .x = function ()
174+ return buildNameConditional () and - 196 or 8
158175 end
159- self .controls .saveAs = new (" ButtonControl" , {" LEFT" ,self .controls .save ," RIGHT" }, {8 , 0 , 70 , 20 }, " Save As" , function ()
160- self :OpenSaveAsPopup ()
161- end )
162- self .controls .saveAs .enabled = function ()
163- return self .dbFileName
176+ self .controls .buildName .y = function ()
177+ return buildNameConditional () and 32 or 0
164178 end
165179
166180 -- Controls: top bar, right side
167181 self .anchorTopBarRight = new (" Control" , nil , {function () return main .screenW / 2 + 6 end , 4 , 0 , 20 })
168- self .controls .pointDisplay = new (" Control" , {" LEFT" ,self .anchorTopBarRight ," RIGHT" }, {- 12 , 0 , 0 , 20 })
169- self .controls .pointDisplay .x = function (control )
170- local width , height = control :GetSize ()
171- if self .controls .saveAs :GetPos () + self .controls .saveAs :GetSize () < self .anchorTopBarRight :GetPos () - width - 16 then
172- return - 12 - width
173- else
174- return 0
175- end
182+
183+ local function getPointDisplayX () -- I had it hardcoded to -323 before switching to the control sizing
184+ return - (23 + self .controls .pointDisplay :GetSize () + self .controls .levelScalingButton :GetSize () + self .controls .characterLevel :GetSize ())
176185 end
186+ self .controls .pointDisplay = new (" Control" , {" LEFT" ,self .anchorTopBarRight ," RIGHT" }, {function () return getPointDisplayX () end , 0 , 0 , 20 })
177187 self .controls .pointDisplay .width = function (control )
178188 control .str , control .req = self :EstimatePlayerProgress ()
179189 return DrawStringWidth (16 , " FIXED" , control .str ) + 8
@@ -195,7 +205,7 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin
195205 SetDrawLayer (nil , 0 )
196206 end
197207 end
198- self .controls .levelScalingButton = new (" ButtonControl" , {" LEFT" ,self .controls .pointDisplay ," RIGHT" }, {10 , 0 , 50 , 20 }, self .characterLevelAutoMode and " Auto" or " Manual" , function ()
208+ self .controls .levelScalingButton = new (" ButtonControl" , {" LEFT" ,self .controls .pointDisplay ," RIGHT" }, {7 , 0 , 50 , 20 }, self .characterLevelAutoMode and " Auto" or " Manual" , function ()
199209 self .characterLevelAutoMode = not self .characterLevelAutoMode
200210 self .controls .levelScalingButton .label = self .characterLevelAutoMode and " Auto" or " Manual"
201211 self .configTab :BuildModList ()
@@ -239,7 +249,7 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin
239249 end
240250 end
241251 end
242- self .controls .classDrop = new (" DropDownControl" , {" LEFT" ,self .controls .characterLevel ," RIGHT" }, {5 , 0 , 85 , 20 }, nil , function (index , value )
252+ self .controls .classDrop = new (" DropDownControl" , {" LEFT" ,self .controls .characterLevel ," RIGHT" }, {10 , 0 , 85 , 20 }, nil , function (index , value )
243253 if value .classId ~= self .spec .curClassId then
244254 if self .spec :CountAllocNodes () == 0 or self .spec :IsClassConnected (value .classId ) then
245255 self .spec :SelectClass (value .classId )
@@ -263,7 +273,29 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin
263273 end
264274 end
265275 end )
266- self .controls .buildLoadouts = new (" DropDownControl" , {" LEFT" ,self .controls .classDrop ," RIGHT" }, {5 , 0 , 190 , 20 }, {}, function (index , value )
276+ self .controls .ascendDrop = new (" DropDownControl" , {" LEFT" ,self .controls .classDrop ," RIGHT" }, {4 , 0 , 120 , 20 }, nil , function (index , value )
277+ self .spec :SelectAscendClass (value .ascendClassId )
278+ self .spec :AddUndoState ()
279+ self .spec :SetWindowTitleWithBuildClass ()
280+ self .buildFlag = true
281+ end )
282+ self .controls .secondaryAscendDrop = new (" DropDownControl" , {" LEFT" ,self .controls .ascendDrop ," RIGHT" }, {4 , 0 , 160 , 20 }, {
283+ { label = " None" , ascendClassId = 0 },
284+ }, function (index , value )
285+ if not value or not self .spec then
286+ return
287+ end
288+ self .spec :SelectSecondaryAscendClass (value .ascendClassId )
289+ self .spec :AddUndoState ()
290+ self .spec :SetWindowTitleWithBuildClass ()
291+ self .buildFlag = true
292+ end )
293+ self .controls .secondaryAscendDrop .enableDroppedWidth = true
294+ self .controls .secondaryAscendDrop .maxDroppedWidth = 360
295+ local initialSecondarySelection = (self .spec and self .spec .curSecondaryAscendClassId ) or 0
296+ self .controls .secondaryAscendDrop :SelByValue (initialSecondarySelection , " ascendClassId" )
297+
298+ self .controls .buildLoadouts = new (" DropDownControl" , {" LEFT" ,self .controls .secondaryAscendDrop ," RIGHT" }, {4 , 0 , 190 , 20 }, {}, function (index , value )
267299 if value == " ^7^7Loadouts:" or value == " ^7^7-----" then
268300 self .controls .buildLoadouts :SetSel (1 )
269301 return
@@ -378,15 +410,6 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin
378410
379411 self .controls .buildLoadouts :SelByValue (value )
380412 end )
381-
382- -- self.controls.similarBuilds = new("ButtonControl", {"LEFT",self.controls.buildLoadouts,"RIGHT"}, {8, 0, 100, 20}, "Similar Builds", function()
383- -- self:OpenSimilarPopup()
384- -- end)
385- -- self.controls.similarBuilds.tooltipFunc = function(tooltip)
386- -- tooltip:Clear()
387- -- tooltip:AddLine(16, "Search for builds similar to your current character.")
388- -- tooltip:AddLine(16, "For best results, make sure to select your main item set, tree, and skills before opening the popup.")
389- -- end
390413
391414 if buildName == " ~~temp~~" then
392415 -- Remove temporary build file
@@ -401,7 +424,11 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin
401424 self .displayStats , self .minionDisplayStats , self .extraSaveStats = LoadModule (" Modules/BuildDisplayStats" )
402425
403426 -- Controls: Side bar
404- self .anchorSideBar = new (" Control" , nil , {4 , 36 , 0 , 0 })
427+ self .anchorSideBar = new (" Control" , nil , {4 , 60 , 0 , 0 })
428+ self .anchorSideBar .y = function ()
429+ return buildNameConditional () and 60 or 36
430+ end
431+
405432 self .controls .modeImport = new (" ButtonControl" , {" TOPLEFT" ,self .anchorSideBar ," TOPLEFT" }, {0 , 0 , 134 , 20 }, " Import/Export Build" , function ()
406433 self .viewMode = " IMPORT"
407434 end )
@@ -1097,6 +1124,44 @@ function buildMode:OnFrame(inputEvents)
10971124 self :ProcessControlsInput (inputEvents , main .viewPort )
10981125
10991126 self .controls .classDrop :SelByValue (self .spec .curClassId , " classId" )
1127+ self .controls .ascendDrop .list = self .controls .classDrop :GetSelValueByKey (" ascendancies" )
1128+ self .controls .ascendDrop :SelByValue (self .spec .curAscendClassId , " ascendClassId" )
1129+ self .controls .ascendDrop :CheckDroppedWidth (true )
1130+ local secondaryDrop = self .controls .secondaryAscendDrop
1131+ if secondaryDrop then
1132+ local legacyAlternateAscendancyIds = {
1133+ Warden = true ,
1134+ Warlock = true ,
1135+ Primalist = true ,
1136+ }
1137+ local entries = {
1138+ { label = " None" , ascendClassId = 0 },
1139+ }
1140+ local selection = (self .spec and self .spec .curSecondaryAscendClassId ) or 0
1141+ if self .spec and self .spec .tree then
1142+ local altAscendancies = self .spec .tree .alternate_ascendancies
1143+ if altAscendancies then
1144+ local sortable = { }
1145+ for ascendClassId , ascendClass in pairs (altAscendancies ) do
1146+ if ascendClass and ascendClass .id then
1147+ if not legacyAlternateAscendancyIds [ascendClass .id ] or ascendClassId == selection then
1148+ t_insert (sortable , { label = ascendClass .name , ascendClassId = ascendClassId })
1149+ end
1150+ end
1151+ end
1152+ t_sort (sortable , function (a , b )
1153+ return a .label < b .label
1154+ end )
1155+ for _ , entry in ipairs (sortable ) do
1156+ t_insert (entries , entry )
1157+ end
1158+ end
1159+ end
1160+ secondaryDrop :SetList (entries )
1161+ secondaryDrop :SelByValue (selection , " ascendClassId" )
1162+ secondaryDrop :CheckDroppedWidth (true )
1163+ secondaryDrop .enabled = self .spec ~= nil and # entries > 1
1164+ end
11001165
11011166 if self .buildFlag then
11021167 -- Wipe Global Cache
0 commit comments