Skip to content

Commit

Permalink
Fix race in hillshade control initialization (#1188)
Browse files Browse the repository at this point in the history
  • Loading branch information
jleedev authored Jan 15, 2025
1 parent 0c0fe2d commit 1868338
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/js/hillshade_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export class HillshadeControl {

this._button = document.createElement("button");
this._button.className = "maplibregl-ctrl-terrain";
this._updateButton();
Promise.resolve(map.loaded() || map.once("load")).then(() =>
this._updateButton()
);
this._button.addEventListener("click", this._onClick);
this._container.append(this._button);

Expand Down

0 comments on commit 1868338

Please sign in to comment.