Quantcast
WoWInterface - View Single Post - How would I add a POI on the map from world location?
View Single Post
10-05-16, 08:46 AM   #4
Nimhfree
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 264
Are you just trying to put an icon on the world map at a specific position? If so, you can do something like:

Code:
local frame = WorldMapDetailFrame
local pin = CreateFrame("Frame", nil, frame)
pin:SetWidth(16)
pin:SetHeight(16)
pin:EnableMouse(true)
pin:SetScript("OnEnter", function(pin) self:ShowTooltip(pin) end) -- this routine you need to write
pin:SetScript("OnLeave", function() self:HideTooltip() end) -- this routine you need to write
-- You need to set the texture of the pin you want to display.  Here is an example
pin.texture:SetTexture("Interface\\MINIMAP\\ObjectIcons.blp")
pin.texture:SetTexCoord(0.125, 0.250, 0.125, 0.250)
pin.texture:SetAllPoints()
-- Make it appear at different levels in the map as desired (other icons can cover it based on what you choose)
pin:SetFrameStrata("TOOLTIP")
pin:SetFrameLevel(frame:GetFrameLevel() + 1)
pin:SetPoint("CENTER", frame, "TOPLEFT", x / 100 * frame:GetWidth(), -y / 100 * frame:GetHeight())
pin:Show()
You will only want to do this if the map being shown matches that of the map associated with the x,y.
  Reply With Quote