mapbox/mapbox-gl-js
View on GitHuboff('load') then on('load') does not work using setStyle
Open
#10,946 opened on Aug 19, 2021
bug :lady_beetle:good first issue
Description
mapbox-gl-js version: v2.4.0
browser: Chrome Version 92.0.4515.159
Steps to Trigger Behavior
Reproduce steps
- add
Map.on('load', func) - add
Map.off('load', func) - add
Map.on('load', func2) - call
Map.setStyle()
Link to Demonstration
https://jsfiddle.net/tsuzk/6o8m9nad
This should work because of this test
Expected Behavior
The Map.on('load', func2) should get called after Map.setStyle()
Actual Behavior
The Map.on('load', func2) does not get called after Map.setStyle()
Workaround
re-instantiate the map with a new stlye https://jsfiddle.net/tsuzk/6o8m9nad/1/
Other info
- This occurs on v1.9.0 so it's not a new behavior in v2.
Priority
Low, since there is a proper workaround