WoW:USERAPI GetCursorScaledPosition: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
mNo edit summary
Line 1: Line 1:
{{userfunc}} <!-- Leave this line in! -->
{{userfunc}} <!-- Leave this line in! -->
<center>'''{{PAGENAME}}''' ''- by [[User:Egingell|Egingell]] -''</center>


Returns the scaled position of the cursor.
Returns the scaled position of the cursor.

Revision as of 16:37, 4 December 2007

This page documents a <i>user-defined function</i> that you can copy and paste into your addon. Replace PREFIX with your addon or lib prefix to avoid conflicts between different versions of these functions.

← User defined functions

Returns the scaled position of the cursor.

local x, y = USERAPI GetCursorScaledPosition()

Function Parameters

Returns

x
The scaled x position of the cursor
y
The scaled y position of the cursor

Example

local x, y = USERAPI GetCursorScaledPosition();
message('('..x..', '..y..')');

Result

(25.45218785412654, 375.45610597856123)

Code

local function USERAPI GetCursorScaledPosition()
	local scale, x, y = UIParent:GetScale(), GetCursorPosition()
	return x / scale, y / scale
end