Skip to content

Commit

Permalink
[Bugfix] Fix scaling issues for certain elements
Browse files Browse the repository at this point in the history
  • Loading branch information
Krealle committed Nov 3, 2024
1 parent f5252e1 commit 45d0ae7
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 46 deletions.
2 changes: 1 addition & 1 deletion Menu/AuraFilterList.lua
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ function Builder.CreateSetting_Auras(parent, which, kind)
auraImportExportFrame.closeBtn:SetScript("OnClick", function() auraImportExportFrame:Hide() end)

auraImportExportFrame.importBtn = Cell:CreateButton(auraImportExportFrame, L["Import"], "green", { 57, 18 })
auraImportExportFrame.importBtn:SetPoint("TOPRIGHT", auraImportExportFrame.closeBtn, "TOPLEFT", P:Scale(1), 0)
auraImportExportFrame.importBtn:SetPoint("TOPRIGHT", auraImportExportFrame.closeBtn, "TOPLEFT", 1, 0)
auraImportExportFrame.importBtn:SetScript("OnClick", function(self)
local curIds = {}

Expand Down
8 changes: 4 additions & 4 deletions Menu/ImportExport.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ function ImportExport:CreateImportExportFrame(which, importFn, exportFn, verifyF
-- close
local closeBtn = Cell:CreateButton(importExportFrame, "×", "red", { 18, 18 }, false, false, "CELL_FONT_SPECIAL",
"CELL_FONT_SPECIAL")
closeBtn:SetPoint("TOPRIGHT", P:Scale(-5), P:Scale(-1))
closeBtn:SetPoint("TOPRIGHT", -5, -1)
closeBtn:SetScript("OnClick", function() importExportFrame:Hide() end)

-- import
local importBtn = Cell:CreateButton(importExportFrame, L["Import"], "green", { 57, 18 })
importBtn:Hide()
importBtn:SetPoint("TOPRIGHT", closeBtn, "TOPLEFT", P:Scale(1), 0)
importBtn:SetPoint("TOPRIGHT", closeBtn, "TOPLEFT", 1, 0)
importBtn:SetScript("OnClick", function()
-- lower frame level
importExportFrame:SetFrameLevel(Menu.window:GetFrameLevel() + 20)
Expand Down Expand Up @@ -144,8 +144,8 @@ function ImportExport:CreateImportExportFrame(which, importFn, exportFn, verifyF
end
end)
Cell:StylizeFrame(textArea.scrollFrame, { 0, 0, 0, 0 }, Cell:GetAccentColorTable())
textArea:SetPoint("TOPLEFT", P:Scale(5), P:Scale(-20))
textArea:SetPoint("BOTTOMRIGHT", P:Scale(-5), P:Scale(5))
textArea:SetPoint("TOPLEFT", 5, -20)
textArea:SetPoint("BOTTOMRIGHT", -5, 5)

-- highlight text
textArea.eb:SetScript("OnEditFocusGained", function() textArea.eb:HighlightText() end)
Expand Down
4 changes: 2 additions & 2 deletions UnitFrames/EditMode.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ local function CreatePositioningPopup()

local closeBtn = Cell:CreateButton(positioningPopup, "×", "red", { 18, 18 }, false, false, "CELL_FONT_SPECIAL",
"CELL_FONT_SPECIAL")
closeBtn:SetPoint("TOPRIGHT", P:Scale(-5), P:Scale(-1))
closeBtn:SetPoint("TOPRIGHT", -5, -1)
closeBtn:SetScript("OnClick", function() positioningPopup:Hide() end)

local title = positioningPopup:CreateFontString(nil, "OVERLAY", "CELL_FONT_CLASS")
Expand Down Expand Up @@ -475,7 +475,7 @@ local function CreateCellEditModePopup()

local closeBtn = Cell:CreateButton(cellPopup, "×", "red", { 18, 18 }, false, false, "CELL_FONT_SPECIAL",
"CELL_FONT_SPECIAL")
closeBtn:SetPoint("TOPRIGHT", P:Scale(-5), P:Scale(-1))
closeBtn:SetPoint("TOPRIGHT", -5, -1)
closeBtn:SetScript("OnClick", function() cellPopup:Hide() end)

local title = cellPopup:CreateFontString(nil, "OVERLAY", "CELL_FONT_CLASS")
Expand Down
32 changes: 16 additions & 16 deletions UnitFrames/UnitButton.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function U:UpdateUnitButtonLayout(unit, kind, button)
width, height = unpack(layout[unit].size)
end

P:Size(button, width, height)
button:SetSize(width, height)
end

-- NOTE: SetOrientation BEFORE SetPowerSize
Expand Down Expand Up @@ -215,29 +215,29 @@ function U:SetOrientation(button, orientation, rotateTexture)

if orientation == "horizontal" then
-- update healthBarLoss
P:ClearPoints(healthBarLoss)
P:Point(healthBarLoss, "TOPRIGHT", healthBar)
P:Point(healthBarLoss, "BOTTOMLEFT", healthBar:GetStatusBarTexture(), "BOTTOMRIGHT")
healthBarLoss:ClearAllPoints()
healthBarLoss:SetPoint("TOPRIGHT", healthBar)
healthBarLoss:SetPoint("BOTTOMLEFT", healthBar:GetStatusBarTexture(), "BOTTOMRIGHT")

-- update powerBarLoss
P:ClearPoints(powerBarLoss)
P:Point(powerBarLoss, "TOPRIGHT", powerBar)
P:Point(powerBarLoss, "BOTTOMLEFT", powerBar:GetStatusBarTexture(), "BOTTOMRIGHT")
powerBarLoss:ClearAllPoints()
powerBarLoss:SetPoint("TOPRIGHT", powerBar)
powerBarLoss:SetPoint("BOTTOMLEFT", powerBar:GetStatusBarTexture(), "BOTTOMRIGHT")
else -- vertical / vertical_health
P:ClearPoints(healthBarLoss)
P:Point(healthBarLoss, "TOPRIGHT", healthBar)
P:Point(healthBarLoss, "BOTTOMLEFT", healthBar:GetStatusBarTexture(), "TOPLEFT")
healthBarLoss:ClearAllPoints()
healthBarLoss:SetPoint("TOPRIGHT", healthBar)
healthBarLoss:SetPoint("BOTTOMLEFT", healthBar:GetStatusBarTexture(), "TOPLEFT")

if orientation == "vertical" then
-- update powerBarLoss
P:ClearPoints(powerBarLoss)
P:Point(powerBarLoss, "TOPRIGHT", powerBar)
P:Point(powerBarLoss, "BOTTOMLEFT", powerBar:GetStatusBarTexture(), "TOPLEFT")
powerBarLoss:ClearAllPoints()
powerBarLoss:SetPoint("TOPRIGHT", powerBar)
powerBarLoss:SetPoint("BOTTOMLEFT", powerBar:GetStatusBarTexture(), "TOPLEFT")
else -- vertical_health
-- update powerBarLoss
P:ClearPoints(powerBarLoss)
P:Point(powerBarLoss, "TOPRIGHT", powerBar)
P:Point(powerBarLoss, "BOTTOMLEFT", powerBar:GetStatusBarTexture(), "BOTTOMRIGHT")
powerBarLoss:ClearAllPoints()
powerBarLoss:SetPoint("TOPRIGHT", powerBar)
powerBarLoss:SetPoint("BOTTOMLEFT", powerBar:GetStatusBarTexture(), "BOTTOMRIGHT")
end
end

Expand Down
4 changes: 2 additions & 2 deletions Widgets/Auras/Auras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ end
---@param styleTable WidgetTable
local function Icons_SetPosition(self, styleTable)
local position = styleTable.position
P:ClearPoints(self)
P:Point(self, position.point, self:GetParent(), position.relativePoint, position.offsetX, position.offsetY)
self:ClearAllPoints()
self:SetPoint(position.point, self:GetParent(), position.relativePoint, position.offsetX, position.offsetY)
end

---@param icons CellAuraIcons
Expand Down
2 changes: 1 addition & 1 deletion Widgets/Auras/Updater.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function W.UpdateAuraWidget(button, unit, which, setting, subSetting, ...)
auras:SetOrientation(styleTable.orientation)
end
if not setting or setting == const.AURA_OPTION_KIND.SIZE then
P:Size(auras, styleTable.size.width, styleTable.size.height)
auras:SetSize(styleTable.size.width, styleTable.size.height)
end
if not setting or setting == const.AURA_OPTION_KIND.SHOW_DURATION then
auras:ShowDuration(styleTable.showDuration)
Expand Down
4 changes: 2 additions & 2 deletions Widgets/Bars/HealthBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ function W:CreateHealthBar(button)

healthBar:SetStatusBarTexture(Cell.vars.texture)
healthBar:SetFrameLevel(button:GetFrameLevel() + 1)
healthBar:SetPoint("TOPLEFT", button, "TOPLEFT", P:Scale(1), P:Scale(-1))
healthBar:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", P:Scale(-1), P:Scale(1))
healthBar:SetPoint("TOPLEFT", button, "TOPLEFT", 1, -1)
healthBar:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -1, 1)

-- smooth
Mixin(healthBar, SmoothStatusBarMixin)
Expand Down
33 changes: 15 additions & 18 deletions Widgets/Bars/PowerBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,18 @@ local function ShowPowerBar(self)
powerBar:Show()
self.widgets.powerBarLoss:Show()

P:ClearPoints(healthBar)
P:ClearPoints(powerBar)
healthBar:ClearAllPoints()
powerBar:ClearAllPoints()
if self.orientation == "horizontal" or self.orientation == "vertical_health" then
P:Point(healthBar, "TOPLEFT", self, "TOPLEFT", CELL_BORDER_SIZE, -CELL_BORDER_SIZE)
P:Point(healthBar, "BOTTOMRIGHT", self, "BOTTOMRIGHT", -CELL_BORDER_SIZE,
self.powerSize + CELL_BORDER_SIZE * 2)
P:Point(powerBar, "TOPLEFT", healthBar, "BOTTOMLEFT", 0, -CELL_BORDER_SIZE)
P:Point(powerBar, "BOTTOMRIGHT", self, "BOTTOMRIGHT", -CELL_BORDER_SIZE, CELL_BORDER_SIZE)
healthBar:SetPoint("TOPLEFT", self, "TOPLEFT", CELL_BORDER_SIZE, -CELL_BORDER_SIZE)
healthBar:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -CELL_BORDER_SIZE, self.powerSize + CELL_BORDER_SIZE * 2)
powerBar:SetPoint("TOPLEFT", healthBar, "BOTTOMLEFT", 0, -CELL_BORDER_SIZE)
powerBar:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -CELL_BORDER_SIZE, CELL_BORDER_SIZE)
else
P:Point(healthBar, "TOPLEFT", self, "TOPLEFT", CELL_BORDER_SIZE, -CELL_BORDER_SIZE)
P:Point(healthBar, "BOTTOMRIGHT", self, "BOTTOMRIGHT",
-(self.powerSize + CELL_BORDER_SIZE * 2),
CELL_BORDER_SIZE)
P:Point(powerBar, "TOPLEFT", healthBar, "TOPRIGHT", CELL_BORDER_SIZE, 0)
P:Point(powerBar, "BOTTOMRIGHT", self, "BOTTOMRIGHT", -CELL_BORDER_SIZE, CELL_BORDER_SIZE)
healthBar:SetPoint("TOPLEFT", self, "TOPLEFT", CELL_BORDER_SIZE, -CELL_BORDER_SIZE)
healthBar:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -(self.powerSize + CELL_BORDER_SIZE * 2), CELL_BORDER_SIZE)
powerBar:SetPoint("TOPLEFT", healthBar, "TOPRIGHT", CELL_BORDER_SIZE, 0)
powerBar:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -CELL_BORDER_SIZE, CELL_BORDER_SIZE)
end

if self:IsVisible() then
Expand All @@ -130,9 +127,9 @@ local function HidePowerBar(self)
self.widgets.powerBar:Hide()
self.widgets.powerBarLoss:Hide()

P:ClearPoints(self.widgets.healthBar)
P:Point(self.widgets.healthBar, "TOPLEFT", self, "TOPLEFT", CELL_BORDER_SIZE, -CELL_BORDER_SIZE)
P:Point(self.widgets.healthBar, "BOTTOMRIGHT", self, "BOTTOMRIGHT", -CELL_BORDER_SIZE, CELL_BORDER_SIZE)
self.widgets.healthBar:ClearAllPoints()
self.widgets.healthBar:SetPoint("TOPLEFT", self, "TOPLEFT", CELL_BORDER_SIZE, -CELL_BORDER_SIZE)
self.widgets.healthBar:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -CELL_BORDER_SIZE, CELL_BORDER_SIZE)
end

-------------------------------------------------
Expand Down Expand Up @@ -236,8 +233,8 @@ function W:CreatePowerBar(button)
powerBar._owner = button
powerBar.enabled = true

P:Point(powerBar, "TOPLEFT", button.widgets.healthBar, "BOTTOMLEFT", 0, -1)
P:Point(powerBar, "BOTTOMRIGHT", button, "BOTTOMRIGHT", -1, 1)
powerBar:SetPoint("TOPLEFT", button.widgets.healthBar, "BOTTOMLEFT", 0, -1)
powerBar:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -1, 1)

powerBar:SetStatusBarTexture(Cell.vars.texture)
powerBar:GetStatusBarTexture():SetDrawLayer("ARTWORK", -7)
Expand Down

0 comments on commit 45d0ae7

Please sign in to comment.