Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
cedarmaps-sdk-web-public
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Cedar Studios
cedarmaps-sdk-web-public
Commits
758a4b59
Commit
758a4b59
authored
Jan 02, 2018
by
Deployer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added search distance method in nearby widget
parent
58e0e7e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
nearby.html
demos/nearby.html
+4
-3
nearby.js
src/nearby.js
+5
-1
No files found.
demos/nearby.html
View file @
758a4b59
...
...
@@ -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>
...
...
src/nearby.js
View file @
758a4b59
...
...
@@ -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
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment