Skip to content

Commit

Permalink
Fixed MarkupObject:Draw's new argument not working without MaxWidth b…
Browse files Browse the repository at this point in the history
…eing set
  • Loading branch information
robotboy655 committed Dec 9, 2021
1 parent 4380388 commit 1a50a5f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions garrysmod/lua/includes/modules/markup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,13 @@ function MarkupObject:Draw( xOffset, yOffset, halign, valign, alphaoverride, tex
surface.SetTextColor( blk.colour.r, blk.colour.g, blk.colour.b, alpha )

surface.SetTextPos( x, y )
if ( textAlign ~= TEXT_ALIGN_LEFT and self.maxWidth ) then
if ( textAlign ~= TEXT_ALIGN_LEFT ) then
local lineWidth = self.lineWidths[ blk.offset.y ]
if ( lineWidth ) then
if ( textAlign == TEXT_ALIGN_CENTER ) then
surface.SetTextPos( x + ( ( self.maxWidth - lineWidth ) / 2 ), y )
surface.SetTextPos( x + ( ( self:GetMaxWidth() - lineWidth ) / 2 ), y )
elseif ( textAlign == TEXT_ALIGN_RIGHT ) then
surface.SetTextPos( x + ( self.maxWidth - lineWidth ), y )
surface.SetTextPos( x + ( self:GetMaxWidth() - lineWidth ), y )
end
end
end
Expand Down

0 comments on commit 1a50a5f

Please sign in to comment.