Skip to content
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

Locale as option #41

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions dist/leaflet-gesture-handling.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,9 @@
* * Version 1.1.8
*/

L.Map.mergeOptions({
gestureHandlingOptions: {
text: {},
duration: 1000
}
});
var gestureHandlingOptions = {
duration: 1000
};

var draggingMap = false;

Expand Down Expand Up @@ -410,8 +407,12 @@
_setupPluginOptions: function () {
//For backwards compatibility, merge gestureHandlingText into the new options object
if (this._map.options.gestureHandlingText) {
this._map.options.gestureHandlingOptions.text = this._map.options.gestureHandlingText;
this._map.options.gestureHandlingOptions = L.extend(gestureHandlingOptions, {
text: this._map.options.gestureHandlingText
});
}

this._map.options.gestureHandlingOptions = L.extend(gestureHandlingOptions, this._map.options.gestureHandlingOptions);
},

_setLanguageContent: function () {
Expand All @@ -423,7 +424,7 @@
//Otherwise auto set it from the language files

//Determine their language e.g fr or en-US
var lang = this._getUserLanguage();
var lang = this._map.options.gestureHandlingOptions.locale || this._getUserLanguage();

//If we couldn't find it default to en
if (!lang) {
Expand Down
2 changes: 1 addition & 1 deletion dist/leaflet-gesture-handling.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/leaflet-gesture-handling.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions src/js/leaflet-gesture-handling.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@
*/
import LanguageContent from "./language-content";

L.Map.mergeOptions({
gestureHandlingOptions: {
text: {},
duration: 1000
}
});
var gestureHandlingOptions = {
duration: 1000
};

var draggingMap = false;

Expand Down Expand Up @@ -103,8 +100,12 @@ export var GestureHandling = L.Handler.extend({
_setupPluginOptions: function() {
//For backwards compatibility, merge gestureHandlingText into the new options object
if (this._map.options.gestureHandlingText) {
this._map.options.gestureHandlingOptions.text = this._map.options.gestureHandlingText;
this._map.options.gestureHandlingOptions = L.extend(gestureHandlingOptions, {
text: this._map.options.gestureHandlingText
});
}

this._map.options.gestureHandlingOptions = L.extend(gestureHandlingOptions, this._map.options.gestureHandlingOptions);
},

_setLanguageContent: function() {
Expand All @@ -122,7 +123,7 @@ export var GestureHandling = L.Handler.extend({
//Otherwise auto set it from the language files

//Determine their language e.g fr or en-US
var lang = this._getUserLanguage();
var lang = this._map.options.gestureHandlingOptions.locale || this._getUserLanguage();

//If we couldn't find it default to en
if (!lang) {
Expand Down