Skip to content

Commit

Permalink
fix edge case with loadImage in Safari (#10524) (#10526)
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner authored Mar 31, 2021
1 parent 50adf1c commit 2a506b9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ui/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -1756,7 +1756,9 @@ class Map extends Camera {
* @see [Add an icon to the map](https://www.mapbox.com/mapbox-gl-js/example/add-image/)
*/
loadImage(url: string, callback: Function) {
getImage(this._requestManager.transformRequest(url, ResourceType.Image), callback);
getImage(this._requestManager.transformRequest(url, ResourceType.Image), (err, img) => {
callback(err, img instanceof HTMLImageElement ? browser.getImageData(img) : img);
});
}

/**
Expand Down

0 comments on commit 2a506b9

Please sign in to comment.