i forgot the link
https://github.com/Ssesmar/MapNote-Test
i also tried it this way and I created a new file and tried this
Lua Code:
local ADDON_NAME, ns = ...
local WorldMapDataProvider = CreateFromMixins(MapCanvasDataProviderMixin)
local WorldMapPinTemplate = ADDON_NAME .. 'WorldMapPinTemplate'
local WorldMapPinMixin = CreateFromMixins(MapCanvasPinMixin)
function WorldMapPinMixin:SetPassThroughButtons() end
_G[ADDON_NAME .. 'WorldMapPinMixin'] = WorldMapPinMixin
function WorldMapDataProvider:RemoveAllData()
if self:GetMap() then
self:GetMap():RemoveAllPinsByTemplate(WorldMapPinTemplate)
end
end
function WorldMapPinMixin:OnLoad()
-- The MAP_HIGHLIGHT frame level is well below the level standard
-- HandyNotes pins use, preventing mouseover conflicts
self:UseFrameLevelType('PIN_FRAME_LEVEL_MAP_HIGHLIGHT')
end
function WorldMapPinMixin:OnAcquired(poi, ...)
local _, _, w, h = self:GetParent():GetRect()
self.parentWidth = w
self.parentHeight = h
if (w and h) then
local x, y = poi:Draw(self, ...)
self:ApplyCurrentScale()
self:SetPosition(x, y)
end
end
function WorldMapPinMixin:OnReleased()
if self.ticker then
self.ticker:Cancel()
self.ticker = nil
end
end
function WorldMapPinMixin:ApplyFrameLevel()
-- Allow frame level adjustments in POIs even if the current frame level
-- type has a range of only 1 frame level
MapCanvasPinMixin.ApplyFrameLevel(self)
self:SetFrameLevel(self:GetFrameLevel() + self.frameOffset)
end
-------------------------------------------------------------------------------
------------------------------ HANDYNOTES HOOKS -------------------------------
-------------------------------------------------------------------------------
-- HandyNotes removes its data provider from the world map when the global
-- enable/disable checkbox is toggled at the top of its UI window. We need
-- to do the same thing here or our paths will still display.
local OnEnable = HandyNotes.OnEnable
local OnDisable = HandyNotes.OnDisable
function HandyNotes:OnEnable()
OnEnable(self)
if not HandyNotes.db.profile.enabled then return end
WorldMapFrame:AddDataProvider(WorldMapDataProvider)
end
function HandyNotes:OnDisable()
OnDisable(self)
if WorldMapFrame.dataProviders[WorldMapDataProvider] then
WorldMapFrame:RemoveDataProvider(WorldMapDataProvider)
end
end
ns.WorldMapDataProvider = WorldMapDataProvider
and added
Lua Code:
ns.WorldMapDataProvider:RefreshAllData()
to the main file under OnEnter and OnLeave. but it doesn't work