-
Notifications
You must be signed in to change notification settings - Fork 265
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 zoom range restriction to keepCurrentZoomLevel #247
base: gh-pages
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -514,7 +514,10 @@ You can find the project at: https://github.com/domoritz/leaflet-locatecontrol | |
this._event = undefined; // clear the current location so we can get back into the bounds | ||
this.options.onLocationOutsideMapBounds(this); | ||
} else { | ||
if (this.options.keepCurrentZoomLevel) { | ||
if (this.options.keepCurrentZoomLevel && ( | ||
typeof this.options.keepCurrentZoomLevel == "boolean" || | ||
(typeof this.options.keepCurrentZoomLevel == "object" && this._map.getZoom() <= this.options.keepCurrentZoomLevel[1] && this._map.getZoom() >= this.options.keepCurrentZoomLevel[0]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you extract this into a variable There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what mean, make something like
if (this.options.keepCurrentZoomLevel) would still be true in case of Array, so the if(..) still complicated. although maybe could do Or to have new
Then could just do... keepCurrentZoomLevel is back to just true/false
|
||
)) { | ||
var f = this.options.flyTo ? this._map.flyTo : this._map.panTo; | ||
f.bind(this._map)([this._event.latitude, this._event.longitude]); | ||
} else { | ||
|
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.
Please correct the grammar of this sentence. Also, end with a
.
.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.
Not sure what the grammer issue is, but have just spotted the rage=>range typo. I'll try fixing this - I think as a new PR.
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.
Something like this (it wasn't clear what the which clause refers to):
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.
just saw reply. I've updated the wording, try to keep clearer. It only zooms when outside the range. It keeps the zoom when within the range! ie keep zoom (if True, or within set range) barryhunter@1eaee57
not clear if that commit, is feeding back to pull request. if not will make a new one, after resolving other comment)