Hello,
I'm working atm. on an AddOn and I want to create Frames at the cursor. Does someone know, how could I do it?
I already tried:
Code:
function ns.round(float)
return floor(float+0.5)
end
function ns.shwcrd(num)
return ns.round(num * 100)
end
function ns:CreateButton(point ,offx, yoff)
local button = CreateFrame("Button", nil, WorldMapButton)
button:SetSize(15, 15)
button:SetBackdrop(backdrop)
button:SetBackdropColor(.0, .0, .0)
button:SetBackdropBorderColor(.125, .125, .125)
button:SetPoint(point, offx, yoff)
button:SetScript("OnEnter", ns.OnEnter)
button:SetScript("OnLeave", ns.OnLeave)
return button
end
local scale = WorldMapDetailFrame:GetEffectiveScale()
local width = WorldMapDetailFrame:GetWidth()
local height = WorldMapDetailFrame:GetHeight()
local centerX, centerY = WorldMapDetailFrame:GetCenter()
local x, y = GetCursorPosition()
local point, relativeTo, relativePoint, xOfs, yOfs = GetMouseFocus():GetPoint()
local adjX = (x / scale - (centerX - (width/2))) / width
local adjY = (centerY + (height/2) - y / scale) / height
ns:CreateButton(point, ns.shwcrd(x), ns.shwcrd(y))
notice.text:SetText(ns.shwcrd(x).." / "..ns.shwcrd(y))
But it doesn't work at all. :S