Skip to content

Commit

Permalink
make getMaxBounds easier to read
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewharvey committed Jun 26, 2017
1 parent cb7ed47 commit 9d80e41
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/ui/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,13 @@ class Map extends Camera {
* @returns {LngLatBounds | null} The maximum bounds the map is constrained to, or `null` if none set.
*/
getMaxBounds () {
if (!(!Array.isArray(this.transform.latRange) || this.transform.latRange.length === 0) &&
(!Array.isArray(this.transform.lngRange) || this.transform.lngRange.length === 0)) {
if (Array.isArray(this.transform.latRange) && this.transform.latRange.length !== 0 &&
Array.isArray(this.transform.lngRange) && this.transform.lngRange.length !== 0) {
return new LngLatBounds([this.transform.lngRange[0], this.transform.latRange[0]],
[this.transform.lngRange[1], this.transform.latRange[1]]);
} else {
return null;
}
return new LngLatBounds([this.transform.lngRange[0], this.transform.latRange[0]],
[this.transform.lngRange[1], this.transform.latRange[1]]);
}

/**
Expand Down

0 comments on commit 9d80e41

Please sign in to comment.