Move popup anchor definition to icon
authorJohn Firebaugh <john.firebaugh@gmail.com>
Fri, 9 Nov 2012 23:57:31 +0000 (15:57 -0800)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Fri, 9 Nov 2012 23:57:31 +0000 (15:57 -0800)
app/assets/javascripts/map.js.erb
app/assets/javascripts/user.js

index 6d15f1fdb4a87f69cd2396c930f64a437c94f6a3..e30e073ba4eafa412a67cb984b5917e2dd56bf54 100644 (file)
@@ -116,7 +116,8 @@ function getUserIcon(url) {
   return L.icon({
     iconUrl: url || <%= asset_path('marker-red.png').to_json %>,
     iconSize: [19, 25],
-    iconAnchor: [11, 26]
+    iconAnchor: [11, 26],
+    popupAnchor: [-1, -20]
   });
 }
 
index 4e1c7d0c3ff19132eced6d9458787b6b788ad220..25456d04ebb080b46564fb359b5801fac551c163 100644 (file)
@@ -33,7 +33,7 @@ $(document).ready(function () {
       var user = $(this).data('user');
       if (user.lon && user.lat) {
         L.marker([user.lat, user.lon], {icon: getUserIcon(user.icon)}).addTo(map)
-          .bindPopup(user.description, {offset: L.point(-1, -20)});
+          .bindPopup(user.description);
       }
     });
   }