Thread Tools Display Modes
01-15-24, 11:10 AM   #1
Ssesmar2
A Murloc Raider
 
Ssesmar2's Avatar
Join Date: Jan 2024
Posts: 6
Set self-created icons to the highest priority/layer

Hey, mby anyone can help. How can I set icons created by my addon on the wow maps so that they are not among other icons created by blizzard on wow maps. So for example the icon on the Kalimdor map from blizzard for Orgrimmar, I have a self-created icon exactly on the Orgrimmar icon, but it is sometimes under the layer of the Orgrimmar icon. Can I change it so that my created icons are always above the icons from Blizzard itself? or is that not possible at all?

Thank you in advance for the help
  Reply With Quote
01-15-24, 12:57 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
It depends. If the frames/Textures used to create the icons are made by your addon, you can use a mixture of
https://warcraft.wiki.gg/wiki/API_Frame_SetFrameStrata

https://warcraft.wiki.gg/wiki/API_Frame_SetFrameLevel

https://warcraft.wiki.gg/wiki/API_Region_SetDrawLayer

to adjust the latering of the various parts.

If the icons are being created by a provider like HandyNotes it might be best to see if the documentation or someone using/authoring that addon might be able to provide a better solution.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
01-16-24, 08:41 AM   #3
Ssesmar2
A Murloc Raider
 
Ssesmar2's Avatar
Join Date: Jan 2024
Posts: 6
Originally Posted by Fizzlemizz View Post
It depends. If the frames/Textures used to create the icons are made by your addon, you can use a mixture of
https://warcraft.wiki.gg/wiki/API_Frame_SetFrameStrata

https://warcraft.wiki.gg/wiki/API_Frame_SetFrameLevel

https://warcraft.wiki.gg/wiki/API_Region_SetDrawLayer

to adjust the latering of the various parts.

If the icons are being created by a provider like HandyNotes it might be best to see if the documentation or someone using/authoring that addon might be able to provide a better solution.
thanks, I'll take a look
  Reply With Quote
01-18-24, 08:02 AM   #4
Ssesmar2
A Murloc Raider
 
Ssesmar2's Avatar
Join Date: Jan 2024
Posts: 6
I've tried different things, for example.
Lua Code:
  1. local WorldMapDataProvider = CreateFromMixins(MapCanvasDataProviderMixin)
  2. local WorldMapPinMixin = CreateFromMixins(MapCanvasPinMixin)
  3.  
  4. function WorldMapPinMixin:SetPassThroughButtons() end
  5.  
  6. function WorldMapPinMixin:OnLoad()
  7.     self:UseFrameLevelType('PIN_FRAME_LEVEL_MAP_HIGHLIGHT')
  8. end
  9.  
  10. function WorldMapPinMixin:ApplyFrameLevel()
  11.     MapCanvasPinMixin.ApplyFrameLevel(self)
  12.     self:SetFrameLevel(self:GetFrameLevel() + self.frameOffset)
  13. end

i also tried to add it directly like xxx:SetFrameLevel(5000)

sometimes my icon or the tooltip is over it and shows it is displayed correctly and sometimes not




but I just can't get it to work. If anyone has the time or desire to help me and tell me why my setframelevel doesn't work or what I forgot to make it work.

Last edited by Ssesmar2 : 01-19-24 at 01:19 PM.
  Reply With Quote
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
01-24-24, 08:24 AM   #6
Ssesmar
A Deviate Faerie Dragon
Join Date: Oct 2023
Posts: 15
If anyone can help in some way I would be happy about it, I have now looked through several addons and tried different options, but it doesn't work, I don't get an error message either, it simply has no function
https://github.com/Ssesmar/MapNote
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Set self-created icons to the highest priority/layer


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off