This page documents a user-defined function 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[edit | edit source]

Returns[edit | edit source]

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

Example[edit | edit source]

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

Result[edit | edit source]

(25.45218785412654, 375.45610597856123)

Code[edit | edit source]

local function USERAPI GetCursorScaledPosition()
	local scale, x, y = UIParent:GetScale(), GetCursorPosition()
	return x / scale, y / scale
end
Community content is available under CC-BY-SA unless otherwise noted.