WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Set self-created icons to the highest priority/layer (https://www.wowinterface.com/forums/showthread.php?t=59764)

Ssesmar2 01-15-24 11:10 AM

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

Fizzlemizz 01-15-24 12:57 PM

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.

Ssesmar2 01-16-24 08:41 AM

Quote:

Originally Posted by Fizzlemizz (Post 343180)
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

Ssesmar2 01-18-24 08:02 AM

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.

Ssesmar2 01-19-24 01:20 PM

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

Ssesmar 01-24-24 08:24 AM

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


All times are GMT -6. The time now is 08:55 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI