Fixed scaling issue with example script.
(Fixed scaling issue with example script.) |
|||
| Line 20: | Line 20: | ||
=== Returns === | === Returns === | ||
: | : Nothing | ||
==Notes== | ==Notes== | ||
The | The bottom left corner of the Model frame will always have coordinates (0,0,0). However, the top right corner's coordinate depends upon the width and height of the Model frame, as well as the screen resolution returned by [[API GetScreenWidth|GetScreenWidth]]/[[API GetScreenHeight|GetScreenHeight]]. The following formula determines the Model-relative coordinate that corresponds to the top-right of the Model frame (''CoordRight'',''CoordTop'',0): | ||
to | |||
local Scale = UIParent:GetEffectiveScale(); | |||
local Hypotenuse = ( ( GetScreenWidth() * Scale ) ^ 2 + ( GetScreenHeight() * Scale ) ^ 2 ) ^ 0.5; | |||
local CoordRight = ( ''MyModelFrame'':GetRight() - ''MyModelFrame'':GetLeft() ) / Hypotenuse; -- X | |||
local CoordTop = ( ''MyModelFrame'':GetTop() - ''MyModelFrame'':GetBottom() ) / Hypotenuse; -- Y | |||