d3 mouse events not triggering after upgrade #5188

Open
khaledosman opened this Issue Dec 13, 2016 · 1 comment

Projects

None yet

2 participants

@khaledosman
khaledosman commented Dec 13, 2016 edited

I have the following code which works in version 0.7.7, after upgrading to 1.x the mouse events are not being triggered.

var map = new L.Map(element[0], worldmapConfiguration.leafletParams);
            // Use Leaflet to implement a D3 geometric transformation.

var transform = d3.geo.transform({
                    point: function (x, y) {
                    var point = map.latLngToLayerPoint(new L.LatLng(y, x));
                    this.stream.point(point.x, point.y);
            }

                }),
                path = d3.geo.path().projection(transform);

   var svg = d3.select(map.getPanes().overlayPane).append("svg")
  scope.feature = svg.append('g').selectAll("g.region")
                        .data(processedRegions)
                        .enter()
                        .append('g')
                        .attr('class', function(d) {
                            return 'region ' + d.region;
                        })
                        .on('click', function(d) {
                       
                        })
                        .on('mouseover', function(d) {
                             console.log('dsadasd');
                        })
                        .on('mousemove', function(d) {
                     
                        })
                        .on('mouseout', function(d) {
                      
                        })
                        .selectAll("path")
                        .data(function(d, i) {
                            return d.countries;
                        })
                        .enter()
                        .append("path")
                        .attr("d", function(d) {
                            d.feature = _.where(data.features, {
                                id: d.country
                            })[0];
                            return path(d.feature);
                        })
                        .style('opacity', function(d) {
                            return fillOpacity(d.region);
                        })
                        .style('fill', function(d) {
                            return getColor(d.region);
                        })
                        .style('stroke', 'white');
@IvanSanchez
Member

Can you publish a fiddle/codepen/playground that displays this behaviour?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment