Garry's Mod Wiki

Revision Difference

Panel:LocalToScreen#524877

<function name="LocalToScreen" parent="Panel" type="classfunc"> <description> Gets the absolute screen position of the position specified relative to the panel. See also <page>Panel:ScreenToLocal</page>. <warning>This function uses a cached value for the screen position of the panel, computed at the end of the last VGUI Think/Layout pass.&lt;br&gt;⤶ ie. inaccurate results may be returned if the panel or any of its ancestors have been repositioned outside of <page>PANEL:Think</page> or <page>PANEL:PerformLayout</page> within the last frame.</warning>⤶ <warning>This function uses a cached value for the screen position of the panel, computed at the end of the last VGUI Think/Layout pass, so inaccurate results may be returned if the panel or any of its ancestors have been re-positioned outside of <page>PANEL:Think</page> or <page>PANEL:PerformLayout</page> within the last frame.</warning>⤶ <note>If the panel uses <page>Panel:Dock</page>, this function will return 0, 0 when the panel was created. The position will be updated in the next frame.</note> </description> <realm>Client</realm> <args> <arg name="posX" type="number">The X coordinate of the position on the panel to translate.</arg> <arg name="posY" type="number">The Y coordinate of the position on the panel to translate.</arg> </args> <rets> <ret name="" type="number">The X coordinate relative to the screen.</ret> <ret name="" type="number">The Y coordinate relative to the screen.</ret> </rets> </function>