Permalink
Browse files

Proper fix for drag'n'drop in spawnmenu

What the hell that code in GM:OnSpawnMenuClose() was doing anyway
  • Loading branch information...
1 parent f5e3feb commit b223182fc658b7f5f08ed54d9ef2e5bd9251eb76 @robotboy655 robotboy655 committed Apr 27, 2016
@@ -13,11 +13,11 @@ local PANEL = {}
function PANEL:Init()
self.ToolMenu = vgui.Create( "ToolMenu", self )
- self.ToolMenu:Dock( RIGHT );
+ self.ToolMenu:Dock( RIGHT )
self.ToolMenu:DockMargin( 0, 20, 3, 10 )
self.CreateMenu = vgui.Create( "CreationMenu", self )
- self.CreateMenu:Dock( FILL );
+ self.CreateMenu:Dock( FILL )
self.CreateMenu:DockMargin( 3, 20, 3, 10 )
self.m_bHangOpen = false
@@ -26,10 +26,10 @@ function PANEL:Init()
self.ToolToggle = vgui.Create( "DImageButton", self )
self.ToolToggle:SetMaterial( "gui/spawnmenu_toggle" )
- self.ToolToggle:SetSize( 16, 16 );
+ self.ToolToggle:SetSize( 16, 16 )
self.ToolToggle.DoClick = function()
- self.ToolMenu:SetVisible( !self.ToolMenu:IsVisible() );
+ self.ToolMenu:SetVisible( !self.ToolMenu:IsVisible() )
self:InvalidateLayout()
if ( self.ToolMenu:IsVisible() ) then
@@ -42,15 +42,14 @@ function PANEL:Init()
end
-
function PANEL:OpenCreationMenuTab( name )
self.CreateMenu:SwitchToName( name )
end
function PANEL:GetToolMenu()
- return self.ToolMenu;
+ return self.ToolMenu
end
--[[---------------------------------------------------------
@@ -221,7 +220,7 @@ concommand.Add( "spawnmenu_reload", CreateSpawnMenu )
function GM:OnSpawnMenuOpen()
-- Let the gamemode decide whether we should open or not..
- if ( !hook.Call( "SpawnMenuOpen", GAMEMODE ) ) then return end
+ if ( !hook.Run( "SpawnMenuOpen" ) ) then return end
if ( IsValid( g_SpawnMenu ) ) then
@@ -236,12 +235,6 @@ function GM:OnSpawnMenuClose()
if ( IsValid( g_SpawnMenu ) ) then g_SpawnMenu:Close() end
- -- We're dragging from the spawnmenu but the spawnmenu is closed
- -- so keep the dragging going using the screen clicker
- if ( dragndrop.IsDragging() ) then
- gui.EnableScreenClicker( true )
- end
-
end
--[[---------------------------------------------------------
@@ -260,7 +253,6 @@ local function SpawnMenuKeyboardFocusOn( pnl )
end
hook.Add( "OnTextEntryGetFocus", "SpawnMenuKeyboardFocusOn", SpawnMenuKeyboardFocusOn )
-
--[[---------------------------------------------------------
Name: HOOK SpawnMenuKeyboardFocusOff
Called when text entry stops needing keyboard focus
@@ -54,10 +54,6 @@ function dragndrop.Drop()
local menu = DermaMenu()
menu.OnRemove = function( m ) -- If user clicks outside of the menu - drop the dragging
dragndrop.StopDragging()
-
- if ( gui.EnableScreenClicker ) then -- TODO: We only should do this if we enabled it.
- gui.EnableScreenClicker( false )
- end
end
for k, v in pairs( dragndrop.m_ReceiverSlot.Menu ) do

0 comments on commit b223182

Please sign in to comment.