Skip to content

Commit

Permalink
fix class toggling on control for IE (#8495)
Browse files Browse the repository at this point in the history
* fix class toggling on control for IE

The second argument of `classList.toggle` is not supported in IE.
So, the control displays as disabled in IE at default.

https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11865865/

* fix the operator for lint

change the ternary operator to if~else condition to pass lint.
  • Loading branch information
cs09g authored and mourner committed Jul 17, 2019
1 parent 0bd3ea6 commit 906c289
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/ui/control/navigation_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,16 @@ class NavigationControl {

_updateZoomButtons() {
const zoom = this._map.getZoom();
this._zoomInButton.classList.toggle('mapboxgl-ctrl-icon-disabled', zoom === this._map.getMaxZoom());
this._zoomOutButton.classList.toggle('mapboxgl-ctrl-icon-disabled', zoom === this._map.getMinZoom());
if (zoom === this._map.getMaxZoom()) {
this._zoomInButton.classList.add('mapboxgl-ctrl-icon-disabled');
} else {
this._zoomInButton.classList.remove('mapboxgl-ctrl-icon-disabled');
}
if (zoom === this._map.getMinZoom()) {
this._zoomOutButton.classList.add('mapboxgl-ctrl-icon-disabled');
} else {
this._zoomOutButton.classList.remove('mapboxgl-ctrl-icon-disabled');
}
}

_rotateCompassArrow() {
Expand Down

0 comments on commit 906c289

Please sign in to comment.