-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
34 lines (32 loc) · 965 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD
define(['leaflet'], factory);
} else if (typeof module !== 'undefined') {
// Node/CommonJS
module.exports = factory(require('leaflet'));
} else {
// Browser globals
if (typeof window.L === 'undefined') {
throw new Error('Leaflet must be loaded first');
}
factory(window.L);
}
}(function (L) {
var SaveMapMixin = {
save: function () {
var center = this.getCenter();
var bounds = this.getBounds();
var mapState = {
zoom: this.getZoom(),
center: [center.lat, center.lng],
bounds: [
[bounds.getNorth(), bounds.getWest()],
[bounds.getSouth(), bounds.getEast()]
],
};
return mapState
}
};
L.Map.include(SaveMapMixin);
}));