Skip to content

Commit

Permalink
small btn adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
schwiti6190 committed Apr 3, 2022
1 parent ecec75c commit 29fe67c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion scripts/gui/hud/CpBaseHud.lua
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,8 @@ function CpBaseHud:addLineTextButton(parent, line, textSize, setting)

local x, y = unpack(self.lines[line].left)
local dx, dy = unpack(self.lines[line].right)
local element = CpHudSettingElement.new(parent, x, y, dx, dy,
local btnYOffset = self.hMargin*0.1
local element = CpHudSettingElement.new(parent, x, y, dx, y - btnYOffset,
incrementalOverlay, decrementalOverlay, textSize)

local callbackIncremental = {
Expand Down
6 changes: 3 additions & 3 deletions scripts/gui/hud/HudElements.lua
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ end
---@class CpHudSettingElement : CpTextHudElement
CpHudSettingElement = {}
local CpHudSettingElement_mt = Class(CpHudSettingElement, CpHudButtonElement)
function CpHudSettingElement.new(parentHudElement, posX, posY, maxPosX, maxPosY, incrementalOverlay, decrementalOverlay,
function CpHudSettingElement.new(parentHudElement, posX, posY, maxPosX, posBtnY, incrementalOverlay, decrementalOverlay,
textSize, textAlignment, textColor, textBold, customMt)
if customMt == nil then
customMt = CpHudSettingElement_mt
Expand All @@ -386,14 +386,14 @@ function CpHudSettingElement.new(parentHudElement, posX, posY, maxPosX, maxPosY,
self.labelElement:setTextDetails("Label")

self.incrementalElement = CpHudButtonElement.new(incrementalOverlay, parentHudElement)
self.incrementalElement:setPosition(maxPosX,maxPosY)
self.incrementalElement:setPosition(maxPosX, posBtnY)
local w = self.incrementalElement:getWidth()
local x = maxPosX - w*1.5
self.textElement = CpTextHudElement.new(parentHudElement, x, posY, textSize-2,RenderText.ALIGN_RIGHT)
self.textElement:setTextDetails("100.00")
w = self.textElement:getWidth()
self.decrementalElement = CpHudButtonElement.new(decrementalOverlay, parentHudElement)
self.decrementalElement:setPosition(x-w*1.5, posY)
self.decrementalElement:setPosition(x-w*1.5, posBtnY)

return self
end
Expand Down

0 comments on commit 29fe67c

Please sign in to comment.