agnostic-maps
Advanced tools
Comparing version 1.1.8 to 1.1.9
{ | ||
"name": "agnostic-maps", | ||
"version": "1.1.8", | ||
"version": "1.1.9", | ||
"description": "A set of wrappers for modern maps API e.g. Open Street Maps and Yandex", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -9,3 +9,3 @@ require('leaflet/dist/leaflet.css'); | ||
const getDefaultScale = function () { return 10; }; | ||
const getDefaultZoomLevel = function () { return 10; }; | ||
@@ -37,6 +37,6 @@ const getMarkerOptions = function (glyph, glyphColor, opacity) { | ||
module.exports.createMap = function (element, position) { | ||
module.exports.createMap = function (element, position, zoomLevel) { | ||
const map = L.map(element); | ||
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {}).addTo(map); | ||
map.setView(L.latLng(position.lat, position.lon), getDefaultScale()); | ||
map.setView(L.latLng(position.lat, position.lon), zoomLevel || getDefaultZoomLevel()); | ||
return map; | ||
@@ -68,2 +68,3 @@ }; | ||
module.exports.getMainRoutePolylineColor = utils.getMainRoutePolylineColor; | ||
module.exports.getMaxZoomLevel = function () {return 18;}; | ||
@@ -89,2 +90,6 @@ module.exports.getOrderMarkerOptions = function (order = {}) { | ||
module.exports.setCenter = function (map, position, zoomLevel) { | ||
map.setView([position.lat, position.lon], zoomLevel); | ||
}; | ||
module.exports.setMarkerOptions = function (marker, options) { | ||
@@ -98,1 +103,5 @@ marker.setIcon(options.icon); | ||
}; | ||
module.exports.setZoom = function (map, zoomLevel) { | ||
map.setZoom(zoomLevel); | ||
}; |
@@ -8,3 +8,3 @@ /* global ymaps */ | ||
const minDistance = 0.000001; | ||
const getDefaultScale = function () { return 10; }; | ||
const getDefaultZoomLevel = function () { return 10; }; | ||
const getMarkerOptions = function (icon, color) { return { preset: 'islands#' + color + icon + 'Icon' }; }; | ||
@@ -23,6 +23,6 @@ const convertCoords = ([lat, lon]) => ({ lat, lon }); | ||
module.exports.createMap = function (element, position) { | ||
module.exports.createMap = function (element, position, zoomLevel) { | ||
return new ymaps.Map(element, { | ||
center: [position.lat, position.lon], | ||
zoom: getDefaultScale(), | ||
zoom: zoomLevel || getDefaultZoomLevel(), | ||
}); | ||
@@ -66,2 +66,3 @@ }; | ||
module.exports.getMainRoutePolylineColor = utils.getMainRoutePolylineColor; | ||
module.exports.getMaxZoomLevel = function () {return 17;}; | ||
@@ -92,2 +93,6 @@ module.exports.getOrderMarkerOptions = function (order = {}) { | ||
module.exports.setCenter = function (map, position, zoomLevel) { | ||
map.setCenter([position.lat, position.lon], zoomLevel); | ||
}; | ||
module.exports.setMarkerOptions = function (marker, options) { | ||
@@ -101,1 +106,5 @@ // eslint-disable-next-line prefer-arrow-callback | ||
}; | ||
module.exports.setZoom = function (map, zoomLevel) { | ||
map.setZoom(zoomLevel); | ||
}; |
11175
178