Permalink
Browse files

Fixed CtrlNumPad firing PerformLayout too often

1 parent 30c5b1d commit 69117094b15d096d904f1bc515ee274c87143477 @robotboy655 robotboy655 committed Apr 27, 2016
Showing with 7 additions and 13 deletions.
  1. +7 −13 garrysmod/gamemodes/sandbox/gamemode/spawnmenu/controls/ctrlnumpad.lua
@@ -1,10 +1,3 @@
---
--- ___ ___ _ _ _ __ _ ___ ___ __ __
--- |_ _|| __| / \ | \_/ | / _| / \ | o \ o \\ V /
--- | | | _| | o || \_/ | ( |_n| o || / / \ /
--- |_| |___||_n_||_| |_| \__/|_n_||_|\\_|\\ |_| 2009
---
---
local PANEL = {}
@@ -71,24 +64,28 @@ function PANEL:PerformLayout()
self.NumPad1:InvalidateLayout( true )
self.NumPad1:SetSize( 100, 50 )
+
+ if ( self.m_ConVar2 ) then
self.NumPad2:InvalidateLayout( true )
self.NumPad2:SetSize( 100, 50 )
-
- self.Label1:SizeToContents()
+ end
if ( !self.m_ConVar2 ) then
+ self.Label1:SizeToContents()
+
self.NumPad2:SetVisible( false )
self.Label2:SetVisible( false )
- self.NumPad1:Center()
+ self.NumPad1:CenterHorizontal( 0.5 )
self.NumPad1:AlignTop( 20 )
self.Label1:CenterHorizontal()
self.Label1:AlignTop( 0 )
else
+ self.Label1:SizeToContents()
self.Label2:SizeToContents()
self.NumPad2:SetVisible( true )
@@ -105,9 +102,6 @@ function PANEL:PerformLayout()
end
-
end
-
-
vgui.Register( "CtrlNumPad", PANEL, "DPanel" )

0 comments on commit 6911709

Please sign in to comment.