-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add map.getMaxBounds method #4890
Conversation
Credit to @lamuertepeluda which provided some of the basis to this commit at #4029 (comment)
f887a32
to
cb7ed47
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏 thanks @andrewharvey! just a small change but otherwise this looks good to me!
src/ui/map.js
Outdated
* @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) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this a little hard to read 😕 can we invert the check ( if (this.transform.latRange && this.transform.latRange.length == 2) && ... else { return null; }
) for clarity?
@@ -434,6 +450,7 @@ class Map extends Camera { | |||
return this; | |||
|
|||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accidental line? 🙃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
everywhere else had a whitespace between methods, so I added one here to be consistent.
9d80e41
to
07cc291
Compare
should be good now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Launch Checklist
part of #4029
Thanks to @lamuertepeluda for the inspiration in #4029 (comment)