Commit f28846f922f8d2b4a0cd5a012bc20941baef45f1
1 parent
45bc2358
Exists in
master
and in
22 other branches
ActionItem515: spread points in same location of google map
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2121 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
13 additions
and
0 deletions
Show diff stats
app/views/search/_google_maps.rhtml
| @@ -7,8 +7,21 @@ | @@ -7,8 +7,21 @@ | ||
| 7 | 7 | ||
| 8 | <script type='text/javascript'> | 8 | <script type='text/javascript'> |
| 9 | 9 | ||
| 10 | +var points = {}; | ||
| 11 | + | ||
| 10 | function putMarker(lat, lng, title, summary) { | 12 | function putMarker(lat, lng, title, summary) { |
| 13 | + | ||
| 14 | + var point_str = lat + ":" + lng; | ||
| 15 | + | ||
| 16 | + if (points[point_str]) { | ||
| 17 | + lng += (Math.random() - 0.5) * 0.02; | ||
| 18 | + lat += (Math.random() - 0.5) * 0.02; | ||
| 19 | + } else { | ||
| 20 | + points[point_str] = true; | ||
| 21 | + } | ||
| 22 | + | ||
| 11 | var point = new GLatLng(lat, lng); | 23 | var point = new GLatLng(lat, lng); |
| 24 | + | ||
| 12 | var options = { 'title' : title }; | 25 | var options = { 'title' : title }; |
| 13 | var marker = new GMarker(point, options); | 26 | var marker = new GMarker(point, options); |
| 14 | map.addOverlay(marker); | 27 | map.addOverlay(marker); |