@@ -24,6 +24,7 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build)
24
24
25
25
self .build = build
26
26
self .isComparing = false ;
27
+ self .isCustomMaxDepth = false ;
27
28
28
29
self .viewer = new (" PassiveTreeView" )
29
30
@@ -188,7 +189,20 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build)
188
189
end )
189
190
190
191
-- Control for setting max node depth to limit calculation time of the heat map
191
- self .controls .nodePowerMaxDepthSelect = new (" DropDownControl" , { " LEFT" , self .controls .treeHeatMap , " RIGHT" }, { 8 , 0 , 50 , 20 }, { " All" , 5 , 10 , 15 }, function (index , value )
192
+ self .controls .nodePowerMaxDepthSelect = new (" DropDownControl" , { " LEFT" , self .controls .treeHeatMap , " RIGHT" }, { 8 , 0 , 55 , 20 }, { " All" , 5 , 10 , 15 , " Custom" }, function (index , value )
193
+ -- Show custom value control and resize/move elements
194
+ self .isCustomMaxDepth = value == " Custom"
195
+ if self .isCustomMaxDepth then
196
+ self .controls .nodePowerMaxDepthSelect .width = 70
197
+ self .controls .nodePowerMaxDepthCustom .shown = true
198
+ self .controls .treeHeatMapStatSelect :SetAnchor (" LEFT" , self .controls .nodePowerMaxDepthCustom , " RIGHT" , nil , nil , nil )
199
+ return
200
+ end
201
+
202
+ self .controls .nodePowerMaxDepthSelect .width = 55
203
+ self .controls .nodePowerMaxDepthCustom .shown = false
204
+ self .controls .treeHeatMapStatSelect :SetAnchor (" LEFT" , self .controls .nodePowerMaxDepthSelect , " RIGHT" , nil , nil , nil )
205
+
192
206
local oldMax = self .build .calcsTab .nodePowerMaxDepth
193
207
194
208
if type (value ) == " number" then
@@ -207,6 +221,17 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build)
207
221
end )
208
222
self .controls .nodePowerMaxDepthSelect .tooltipText = " Limit of Node distance to search (lower = faster)"
209
223
224
+ -- Control for setting max node depth by custom value
225
+ self .controls .nodePowerMaxDepthCustom = new (" EditControl" , { " LEFT" , self .controls .nodePowerMaxDepthSelect , " RIGHT" }, { 8 , 0 , 70 , 20 }, " 0" , nil , " %D" , nil , function (value )
226
+ self .build .calcsTab .nodePowerMaxDepth = tonumber (value )
227
+
228
+ -- If the heat map is shown, recalculate it with new value
229
+ if self .viewer .showHeatMap then
230
+ self :SetPowerCalc (self .build .calcsTab .powerStat )
231
+ end
232
+ end )
233
+ self .controls .nodePowerMaxDepthCustom .shown = false
234
+
210
235
-- Control for selecting the power stat to sort by (Defense, DPS, etc)
211
236
self .controls .treeHeatMapStatSelect = new (" DropDownControl" , { " LEFT" , self .controls .nodePowerMaxDepthSelect , " RIGHT" }, { 8 , 0 , 150 , 20 }, nil , function (index , value )
212
237
self :SetPowerCalc (value )
@@ -314,15 +339,42 @@ function TreeTabClass:Draw(viewPort, inputEvents)
314
339
self :ProcessControlsInput (inputEvents , viewPort )
315
340
316
341
-- Determine positions if one line of controls doesn't fit in the screen width
317
- local twoLineHeight = 24
318
- if viewPort .width >= 1336 + (self .isComparing and 198 or 0 ) + (self .viewer .showHeatMap and 316 or 0 ) then
319
- twoLineHeight = 0
342
+ local linesHeight = 24
343
+ local rightMargin = 10
344
+ local widthFirstLineControls = self .controls .specSelect .width + 8
345
+ + self .controls .compareCheck .width + self .controls .compareCheck .x
346
+ + self .controls .reset .width + self .controls .reset .x
347
+ + self .controls .versionText .width () + self .controls .versionText .x
348
+ + self .controls .versionSelect .width + self .controls .versionSelect .x
349
+ + (self .isComparing and (self .controls .compareSelect .width + self .controls .compareSelect .x ) or 0 )
350
+
351
+ local widthSecondLineControls = self .controls .treeSearch .width + 8
352
+ + self .controls .findTimelessJewel .width + self .controls .findTimelessJewel .x
353
+ + self .controls .treeHeatMap .width + 130
354
+ + self .controls .nodePowerMaxDepthSelect .width + self .controls .nodePowerMaxDepthSelect .x
355
+ + (self .isCustomMaxDepth and (self .controls .nodePowerMaxDepthCustom .width + self .controls .nodePowerMaxDepthCustom .x ) or 0 )
356
+ + (self .viewer .showHeatMap and (self .controls .treeHeatMapStatSelect .width + self .controls .treeHeatMapStatSelect .x
357
+ + self .controls .powerReport .width + self .controls .powerReport .x ) or 0 )
358
+
359
+ -- Check first line
360
+ if viewPort .width >= widthFirstLineControls + widthSecondLineControls + rightMargin then
361
+ linesHeight = 0
320
362
self .controls .treeSearch :SetAnchor (" LEFT" , self .controls .versionSelect , " RIGHT" , 8 , 0 )
321
- self .controls .powerReportList :SetAnchor (" TOPLEFT" , self .controls .specSelect , " BOTTOMLEFT" , 0 , self .controls .specSelect .height + 4 )
363
+ self .controls .powerReportList :SetAnchor (" TOPLEFT" , self .controls .specSelect , " BOTTOMLEFT" , 0 , self .controls .specSelect .height + 6 )
322
364
else
323
365
self .controls .treeSearch :SetAnchor (" TOPLEFT" , self .controls .specSelect , " BOTTOMLEFT" , 0 , 4 )
324
- self .controls .powerReportList :SetAnchor (" TOPLEFT" , self .controls .treeSearch , " BOTTOMLEFT" , 0 , self .controls .treeHeatMap . y + self . controls . treeHeatMap . height + 4 )
366
+ self .controls .powerReportList :SetAnchor (" TOPLEFT" , self .controls .treeSearch , " BOTTOMLEFT" , 0 , self .controls .treeSearch . height + 6 )
325
367
end
368
+
369
+ -- Check second line
370
+ if viewPort .width >= widthSecondLineControls + rightMargin then
371
+ self .controls .treeHeatMap :SetAnchor (" LEFT" , self .controls .findTimelessJewel , " RIGHT" , 130 , 0 )
372
+ else
373
+ linesHeight = linesHeight * 2
374
+ self .controls .treeHeatMap :SetAnchor (" TOPLEFT" , self .controls .treeSearch , " BOTTOMLEFT" , 124 , 4 )
375
+ self .controls .powerReportList :SetAnchor (" TOPLEFT" , self .controls .treeHeatMap , " BOTTOMLEFT" , - 124 , self .controls .treeHeatMap .height + 6 )
376
+ end
377
+
326
378
-- determine positions for convert line of controls
327
379
local convertTwoLineHeight = 24
328
380
local convertMaxWidth = 900
@@ -336,9 +388,9 @@ function TreeTabClass:Draw(viewPort, inputEvents)
336
388
end
337
389
338
390
local bottomDrawerHeight = self .controls .powerReportList .shown and 194 or 0
339
- self .controls .specSelect .y = - bottomDrawerHeight - twoLineHeight
391
+ self .controls .specSelect .y = - bottomDrawerHeight - linesHeight
340
392
341
- local treeViewPort = { x = viewPort .x , y = viewPort .y , width = viewPort .width , height = viewPort .height - (self .showConvert and 64 + bottomDrawerHeight + twoLineHeight or 32 + bottomDrawerHeight + twoLineHeight )}
393
+ local treeViewPort = { x = viewPort .x , y = viewPort .y , width = viewPort .width , height = viewPort .height - (self .showConvert and 64 + bottomDrawerHeight + linesHeight or 32 + bottomDrawerHeight + linesHeight )}
342
394
if self .jumpToNode then
343
395
self .viewer :Focus (self .jumpToX , self .jumpToY , treeViewPort , self .build )
344
396
self .jumpToNode = false
@@ -369,17 +421,17 @@ function TreeTabClass:Draw(viewPort, inputEvents)
369
421
SetDrawLayer (1 )
370
422
371
423
SetDrawColor (0.05 , 0.05 , 0.05 )
372
- DrawImage (nil , viewPort .x , viewPort .y + viewPort .height - (28 + bottomDrawerHeight + twoLineHeight ), viewPort .width , 28 + bottomDrawerHeight + twoLineHeight )
424
+ DrawImage (nil , viewPort .x , viewPort .y + viewPort .height - (28 + bottomDrawerHeight + linesHeight ), viewPort .width , 28 + bottomDrawerHeight + linesHeight )
373
425
if self .showConvert then
374
- local height = viewPort .width < convertMaxWidth and (bottomDrawerHeight + twoLineHeight ) or 0
426
+ local height = viewPort .width < convertMaxWidth and (bottomDrawerHeight + linesHeight ) or 0
375
427
SetDrawColor (0.05 , 0.05 , 0.05 )
376
- DrawImage (nil , viewPort .x , viewPort .y + viewPort .height - (60 + bottomDrawerHeight + twoLineHeight + convertTwoLineHeight ), viewPort .width , 28 + height )
428
+ DrawImage (nil , viewPort .x , viewPort .y + viewPort .height - (60 + bottomDrawerHeight + linesHeight + convertTwoLineHeight ), viewPort .width , 28 + height )
377
429
SetDrawColor (0.85 , 0.85 , 0.85 )
378
- DrawImage (nil , viewPort .x , viewPort .y + viewPort .height - (64 + bottomDrawerHeight + twoLineHeight + convertTwoLineHeight ), viewPort .width , 4 )
430
+ DrawImage (nil , viewPort .x , viewPort .y + viewPort .height - (64 + bottomDrawerHeight + linesHeight + convertTwoLineHeight ), viewPort .width , 4 )
379
431
end
380
432
-- let white lines overwrite the black sections, regardless of showConvert
381
433
SetDrawColor (0.85 , 0.85 , 0.85 )
382
- DrawImage (nil , viewPort .x , viewPort .y + viewPort .height - (32 + bottomDrawerHeight + twoLineHeight ), viewPort .width , 4 )
434
+ DrawImage (nil , viewPort .x , viewPort .y + viewPort .height - (32 + bottomDrawerHeight + linesHeight ), viewPort .width , 4 )
383
435
384
436
self :DrawControls (viewPort )
385
437
end
0 commit comments