-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
geolocation button closes issue#780 (#800)
* geolocation button * Delete index.js * Delete multipleExtents.html * some changes to the file * button name change * minor edits * geolocation sync with controlslist api * tests fixed and syncing web-map * Peter suggested changes * locate api * locateapi and locate button test * tests * locate button title changes when its state changes * locatebutton states test * web-map syncing * Remove the word "control" from button title * Remove the word "control" from button title * Fix test * grunt file change * Finalize text strings prior to localization * Localize text strings for location control button states * custom marker * small changes and tests * locate APi bug fix * minor styling fix * marker image made to svg * Alliyan suggested changes * locateapi test bug fix * marker title changes depends on statr * Localize text strings for my current or cached location marker * Update test to use variables for geolocation button states * tooltip focus * tooltip test added * geolocationbutton code refactored * fixed tests and small fixes * Formatting --------- Co-authored-by: Peter Rushforth <peter.rushforth@gmail.com> Co-authored-by: AliyanH <aliyanulhaq@gmail.com>
- Loading branch information
1 parent
2082d1b
commit d24a606
Showing
14 changed files
with
562 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
export var GeolocationButton = L.Control.extend({ | ||
options: { | ||
position: 'bottomright' | ||
}, | ||
|
||
onAdd: function (map) { | ||
this.locateControl = L.control.locate({ | ||
showPopup: false, | ||
strings: { | ||
title: M.options.locale.btnLocTrackOff | ||
}, | ||
position: this.options.position, | ||
locateOptions: { | ||
maxZoom: 16 | ||
} | ||
}).addTo(map); | ||
|
||
var container = this.locateControl._container; | ||
var button = this.locateControl; | ||
var observer = new MutationObserver(function(mutations) { | ||
if (container.classList.contains('active') && container.classList.contains('following')) { | ||
container.firstChild.title = M.options.locale.btnLocTrackOn; | ||
button._marker.bindTooltip(M.options.locale.btnMyLocTrackOn,{permanent:true}); | ||
} else if (container.classList.contains('active')) { | ||
container.firstChild.title = M.options.locale.btnLocTrackLastKnown; | ||
button._marker.bindTooltip(M.options.locale.btnMyLastKnownLocTrackOn); | ||
} else { | ||
container.firstChild.title = M.options.locale.btnLocTrackOff; | ||
} | ||
}); | ||
var observerConfig = { attributes: true, attributeFilter: ['class'] }; | ||
observer.observe(container, observerConfig); | ||
|
||
return container; | ||
}, | ||
|
||
stop: function () { | ||
return this.locateControl.stop(); | ||
} | ||
}); | ||
|
||
export var geolocationButton = function (options) { | ||
return new GeolocationButton(options); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.