Permalink
Browse files

Panel:IsChildHovered 'immediate' parameter

Can now optionally check only the immediate child
  • Loading branch information...
1 parent dc55a94 commit d82961d0067f746539c6d0d08a1afcc3ffaf2309 @willox willox committed Jan 28, 2016
Showing with 5 additions and 2 deletions.
  1. +5 −2 garrysmod/lua/includes/extensions/client/panel.lua
@@ -545,12 +545,15 @@ function meta:Hide()
self:SetVisible( false )
end
-function meta:IsChildHovered()
+function meta:IsChildHovered( bImmediate )
local Hovered = vgui.GetHoveredPanel()
if ( !IsValid( Hovered ) ) then return false end
if ( Hovered == self ) then return false end
+ -- Check immediate child only (with support for old depth parameter)
+ if ( bImmediate == true or bImmediate == 1 ) then return Hovered:GetParent() == self end
+
return Hovered:HasParent( self )
-end
+end

0 comments on commit d82961d

Please sign in to comment.