View Single Post
01-19-24, 01:20 PM   #5
Ssesmar2
A Murloc Raider
 
Ssesmar2's Avatar
Join Date: Jan 2024
Posts: 6
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:
  1. local ADDON_NAME, ns = ...
  2.  
  3. local WorldMapDataProvider = CreateFromMixins(MapCanvasDataProviderMixin)
  4. local WorldMapPinTemplate = ADDON_NAME .. 'WorldMapPinTemplate'
  5. local WorldMapPinMixin = CreateFromMixins(MapCanvasPinMixin)
  6.  
  7. function WorldMapPinMixin:SetPassThroughButtons() end
  8.  
  9. _G[ADDON_NAME .. 'WorldMapPinMixin'] = WorldMapPinMixin
  10.  
  11. function WorldMapDataProvider:RemoveAllData()
  12.     if self:GetMap() then
  13.         self:GetMap():RemoveAllPinsByTemplate(WorldMapPinTemplate)
  14.     end
  15. end
  16.  
  17. function WorldMapPinMixin:OnLoad()
  18.     -- The MAP_HIGHLIGHT frame level is well below the level standard
  19.     -- HandyNotes pins use, preventing mouseover conflicts
  20.     self:UseFrameLevelType('PIN_FRAME_LEVEL_MAP_HIGHLIGHT')
  21. end
  22.  
  23. function WorldMapPinMixin:OnAcquired(poi, ...)
  24.     local _, _, w, h = self:GetParent():GetRect()
  25.     self.parentWidth = w
  26.     self.parentHeight = h
  27.     if (w and h) then
  28.         local x, y = poi:Draw(self, ...)
  29.         self:ApplyCurrentScale()
  30.         self:SetPosition(x, y)
  31.     end
  32. end
  33.  
  34. function WorldMapPinMixin:OnReleased()
  35.     if self.ticker then
  36.         self.ticker:Cancel()
  37.         self.ticker = nil
  38.     end
  39. end
  40.  
  41. function WorldMapPinMixin:ApplyFrameLevel()
  42.     -- Allow frame level adjustments in POIs even if the current frame level
  43.     -- type has a range of only 1 frame level
  44.     MapCanvasPinMixin.ApplyFrameLevel(self)
  45.     self:SetFrameLevel(self:GetFrameLevel() + self.frameOffset)
  46. end
  47.  
  48. -------------------------------------------------------------------------------
  49. ------------------------------ HANDYNOTES HOOKS -------------------------------
  50. -------------------------------------------------------------------------------
  51.  
  52. -- HandyNotes removes its data provider from the world map when the global
  53. -- enable/disable checkbox is toggled at the top of its UI window. We need
  54. -- to do the same thing here or our paths will still display.
  55.  
  56. local OnEnable = HandyNotes.OnEnable
  57. local OnDisable = HandyNotes.OnDisable
  58.  
  59. function HandyNotes:OnEnable()
  60.     OnEnable(self)
  61.     if not HandyNotes.db.profile.enabled then return end
  62.     WorldMapFrame:AddDataProvider(WorldMapDataProvider)
  63. end
  64.  
  65. function HandyNotes:OnDisable()
  66.     OnDisable(self)
  67.     if WorldMapFrame.dataProviders[WorldMapDataProvider] then
  68.         WorldMapFrame:RemoveDataProvider(WorldMapDataProvider)
  69.     end
  70. end
  71.  
  72. ns.WorldMapDataProvider = WorldMapDataProvider

and added
Lua Code:
  1. ns.WorldMapDataProvider:RefreshAllData()
to the main file under OnEnter and OnLeave. but it doesn't work
__________________
Yes, I am a beginner and sometimes you learn better when you learn by example rather than by stubbornly grasping information

Last edited by Ssesmar2 : 01-20-24 at 02:28 AM.
  Reply With Quote