Commit 758a4b59 authored by Deployer's avatar Deployer

Added search distance method in nearby widget

parent 58e0e7e3
......@@ -25,7 +25,7 @@
</head>
<body>
<div id='map' class='map'> </div>
<div id='map' class='map'></div>
<script>
try {
L.cedarmaps.accessToken = accessToken;
......@@ -35,13 +35,14 @@
}
var nb = L.cedarmaps.nearby('map', [35.737334, 51.355215], {
categories: ['bus', 'park', 'shopping', 'hospital', 'school'],
searchDistance: 5,
searchDistance: 1,
popupContent: '<h2>html is allowed here</h2>',
defaultZoom: 20
});
setTimeout(function() {
nb.updateCategories(['bus', 'park'])
nb.updateCategories(['bus', 'park', 'shopping'])
nb.centerMarker.setLatLng({lat: 35.738934, lon: 51.356315})
nb.updateSearchDistance(80)
nb.map.setView({lat: 35.738934, lon: 51.356315})
}, 5000)
</script>
......
......@@ -77,7 +77,7 @@ module.exports = function (container, center, options) {
lat: poi.lat
}, {
icon: L.divIcon({
html: category == 'bus' ? '' : '<img style="width:27px; margin:2px;" src="https://www.kikojas.com/img/categories/red/32/' + availableCategories[category].slug + '.png"/>',
html: category == 'bus' ? '' : '<img style="width:27px; margin:2px;" src="https://www.kikojas.com/img/categories/red/64/' + availableCategories[category].slug + '.png"/>',
iconSize: [34, 44],
className: 'kikojas-map-marker',
iconAnchor: [31, 41],
......@@ -382,6 +382,10 @@ module.exports = function (container, center, options) {
})
ctrl.addTo(map)
},
updateSearchDistance: function(distance) {
options.seachDistance = distance
getPois(centerMarker.getLatLng())
},
map: map,
centerMarker: centerMarker
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment