Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you change the offset for a leaflet popup using angular leaflet directive and geojson?

I'm using the angular-leaflet-directive and geojson to create map markers using leaflet and mapbox. The popups on the markers aren't correctly aligned on the marker.

offset problem

angular.extend($scope, { // Map data
                geojson: {
                    data: $scope.filteredShows,
                    onEachFeature: function (feature, layer) {
                        layer.bindPopup(feature.properties.artist + ' · ' + feature.properties.venue);
                        layer.setIcon(defaultMarker);
                        layer.on({
                            mouseover: pointMouseover,
                            mouseout: pointMouseout
                        });
                        layers[feature.properties.id] = layer;
                    }
                }

            });

How do I change the offset on the markers?

like image 533
Kyle Pennell Avatar asked Mar 16 '23 20:03

Kyle Pennell


1 Answers

Using popupAnchor: [-10, -10], in L.Icon. See http://leafletjs.com/reference.html#icon

like image 117
vitalik_74 Avatar answered Apr 30 '23 02:04

vitalik_74