From 4e8cd1990e57b2fed789bb977fd8ecbbe2d2b17f Mon Sep 17 00:00:00 2001 From: Openarl Date: Sat, 18 Feb 2017 23:20:09 +1000 Subject: [PATCH] Quick fix for the save buttons covering the points display at low resolutions --- Modules/Build.lua | 39 ++++++++++++++++++++++++++------------- README.md | 1 + changelog.txt | 1 + manifest.xml | 4 ++-- 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/Modules/Build.lua b/Modules/Build.lua index a66f8972..7e039158 100644 --- a/Modules/Build.lua +++ b/Modules/Build.lua @@ -37,10 +37,12 @@ function buildMode:Init(dbFileName, buildName) end end) self.controls.buildName = common.New("Control", {"LEFT",self.controls.back,"RIGHT"}, 8, 0, 0, 20) + self.controls.buildName.width = function(control) + return DrawStringWidth(16, "VAR", self.buildName) + 98 + end self.controls.buildName.Draw = function(control) local x, y = control:GetPos() local bnw = DrawStringWidth(16, "VAR", self.buildName) - control.width = bnw + 98 SetDrawColor(0.5, 0.5, 0.5) DrawImage(nil, x + 91, y, bnw + 6, 20) SetDrawColor(0, 0, 0) @@ -63,29 +65,40 @@ function buildMode:Init(dbFileName, buildName) -- Controls: top bar, right side self.anchorTopBarRight = common.New("Control", nil, function() return main.screenW / 2 + 6 end, 4, 0, 20) - self.controls.pointDisplay = common.New("Control", {"RIGHT",self.anchorTopBarRight,"LEFT"}, -12, 0, 0, 20) - self.controls.pointDisplay.Draw = function(control) - local x, y = control:GetPos() + self.controls.pointDisplay = common.New("Control", {"LEFT",self.anchorTopBarRight,"RIGHT"}, -12, 0, 0, 20) + self.controls.pointDisplay.x = function(control) + local width, height = control:GetSize() + if self.controls.saveAs:GetPos() + self.controls.saveAs:GetSize() < self.anchorTopBarRight:GetPos() - width - 16 then + return -12 - width + else + return 0 + end + end + self.controls.pointDisplay.width = function(control) local used, ascUsed = self.spec:CountAllocNodes() local usedMax = 120 + (self.calcsTab.mainOutput.ExtraPoints or 0) local ascMax = 8 - local str = string.format("%s%3d / %3d %s%d / %d", used > usedMax and "^1" or "^7", used, usedMax, ascUsed > ascMax and "^1" or "^7", ascUsed, ascMax) - local strW = DrawStringWidth(16, "FIXED", str) + 6 - control.width = strW + 2 + control.str = string.format("%s%3d / %3d %s%d / %d", used > usedMax and "^1" or "^7", used, usedMax, ascUsed > ascMax and "^1" or "^7", ascUsed, ascMax) + control.req = "Required level: "..m_max(1, (100 + used - usedMax)) + return DrawStringWidth(16, "FIXED", control.str) + 8 + end + self.controls.pointDisplay.Draw = function(control) + local x, y = control:GetPos() + local width, height = control:GetSize() SetDrawColor(1, 1, 1) - DrawImage(nil, x, y, strW + 2, 20) + DrawImage(nil, x, y, width, height) SetDrawColor(0, 0, 0) - DrawImage(nil, x + 1, y + 1, strW, 18) + DrawImage(nil, x + 1, y + 1, width - 2, height - 2) SetDrawColor(1, 1, 1) - DrawString(x + 4, y + 2, "LEFT", 16, "FIXED", str) + DrawString(x + 4, y + 2, "LEFT", 16, "FIXED", control.str) if control:IsMouseInBounds() then SetDrawLayer(nil, 10) - main:AddTooltipLine(16, "Required level: "..m_max(1, (100 + used - usedMax))) - main:DrawTooltip(x, y, control.width, control.height, main.viewPort) + main:AddTooltipLine(16, control.req) + main:DrawTooltip(x, y, width, height, main.viewPort) SetDrawLayer(nil, 0) end end - self.controls.characterLevel = common.New("EditControl", {"LEFT",self.anchorTopBarRight,"RIGHT"}, 0, 0, 106, 20, "", "Level", "%D", 3, function(buf) + self.controls.characterLevel = common.New("EditControl", {"LEFT",self.controls.pointDisplay,"RIGHT"}, 12, 0, 106, 20, "", "Level", "%D", 3, function(buf) self.characterLevel = m_min(tonumber(buf) or 1, 100) self.modFlag = true self.buildFlag = true diff --git a/README.md b/README.md index edf0c0bf..1eb75a7c 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ Head over to the [Releases](https://github.com/Openarl/PathOfBuilding/releases) ### 1.3.2 - 2017/02/18 * Added support for the "increased Effect of Buffs on You" modifier on Ichimonji * Added basic support for Detonate Dead; only the base damage is used + * The points display in the top bar will now move to the right of center if the Save/Save As buttons would cover it * Fixed issue preventing Unarmed from being correctly detected ### 1.3.1 - 2017/02/18 diff --git a/changelog.txt b/changelog.txt index c140672d..abe8478d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,7 @@ VERSION[1.3.2][2017/02/18] * Added support for the "increased Effect of Buffs on You" modifier on Ichimonji * Added basic support for Detonate Dead; only the base damage is used + * The points display in the top bar will now move to the right of center if the Save/Save As buttons would cover it * Fixed issue preventing Unarmed from being correctly detected VERSION[1.3.1][2017/02/18] * Added socket count to the tooltips in the passive tree selection dropdown menu diff --git a/manifest.xml b/manifest.xml index 6ecff980..fcb07f1f 100644 --- a/manifest.xml +++ b/manifest.xml @@ -7,7 +7,7 @@ - + @@ -42,7 +42,7 @@ - +