Created
March 31, 2013 11:16
-
-
Save tluyben/5280319 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Field parentCache:GuiVector2D | |
'summary: This returns the rendering position of this control. The result is presented on Device coordinates. (screen pixels) | |
Method CalculateRenderPosition:GuiVector2D() | |
If _cacheRenderPosCalcuation = Null Then _cacheRenderPosCalcuation = New GuiVector2D | |
_cacheRenderPosCalcuation.SetValues (Position.X, Position.Y) | |
If parentCache = Null | |
parentCache = New GuiVector2D() | |
parentCache.SetValues(0,0) | |
Local parent:ContainerControl = _parentControl | |
While parent<>Null | |
parentCache.X += parent.Position.X + parent.Padding.Left | |
parentCache.Y += parent.Position.Y + parent.Padding.Top | |
parent = parent._parentControl | |
Wend | |
End | |
_cacheRenderPosCalcuation.X += parentCache.X | |
_cacheRenderPosCalcuation.Y += parentCache.Y | |
Return _cacheRenderPosCalcuation | |
End |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment