Open mollymerp opened 7 years ago
hmm I am unable to figure out how i should do the style.load
event now? Tried load
also.
example: (removed) press [+] to load new style, event doesn't get fired and when pressed again I get warning?
@gertcuykens style.load
was never part of our public API. I believe the styledata
event has the behaviour you're looking for.
yes and no :) because when I use styledata
instead i get allot of error messages in the form of
in previous versions using style.load
i was guaranteed I could add new sources and build my map back up again from scratch when the event got fired when switching styles. Note, that I could have just been lucky things didn't break :) But as far as I can tell there is no other event that only get called once when switching styles?
map.on('styledata', function () {
map.addSource('markers', {
type: 'geojson',
data: markers,
cluster: true,
clusterMaxZoom: 14,
clusterRadius: 30
})
map.addSource('traces', {
type: 'geojson',
data: traces
})
if (location.search.substring(1) !== '') {
draw()
} else {
map.getSource('traces').setData(traces)
}
map.getSource('markers').setData(markers)
paint()
threadBuffer.postMessage(null)
threadSPOT.postMessage(null)
}
Thanks for the heads-up about that caveat to styledata
@gertcuykens. We will fix that in conjunction with deprecating style.load
.
Updating issue name since source.load
is no longer an event
per chat w @lucaswoj yesterday and with added motivation from #3958, we should simply eventing by removing all events that do not fall within the schema of the
data
events from #3590, and extending the current implementation to cover the use cases of the old events.