Garry's Mod Wiki

Panel:DistanceFrom

  number Panel:DistanceFrom( number posX, number posY )

Description

Returns the distance between the center of this panel object and a specified point local to the parent panel.

Arguments

1 number posX
The horizontal (x) position in pixels of the point to compare with. Local to the parent panel, or container, not the panel the function is called on.
2 number posY
The vertical (y) position in pixels of the point to compare with. Local to the parent panel, or container, not the panel the function is called on.

Returns

1 number
The linear (straight-line) distance between the specified point local to parent panel and the center of this panel object.