View Single Post
07-24-18, 10:50 AM   #3
Gello
A Molten Giant
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 521
I'm not comfortably fluent in the new map yet, but you could also create a data provider (which you may already have if you're putting stuff on the map):
Code:
-- mixin is at Interface\AddOns\Blizzard_MapCanvas_DataProviderBase.lua
dataProvider = CreateFromMixins(MapCanvasDataProviderMixin)

-- the RefreshAllData() method is called in the default implementation
function dataProvider:OnMapChanged()
  print("OnMapChanged")
end

WorldMapFrame:AddDataProvider(dataProvider)
You could also use RefreshAllData() as your "map has changed" event (the default OnMapChanged() calls it)
Code:
function MapCanvasDataProviderMixin:OnMapChanged()
  --  Optionally override in your mixin, called when map ID changes
  self:RefreshAllData();
end
There's a thread in the PTR forums about the table creation from GetXY().

If you still need an OnUpdate, one idea to minimize calls would be to register for the events where you start and stop moving. (PLAYER_STARTED_MOVING, PLAYER_STOPPED_MOVING) But I don't know if the event still fires when on a taxi.
  Reply With Quote