Skip to content

GeoJSON mouse events not triggered with preferCanvas=true #599

Open
@digEmAll

Description

@digEmAll

Description

The CircleMarker layer seems to block the LGeoJson mouse interactivity when preferCanvas: true.

Live Demo

I prepared the following code-sandbox reproducing the issue:
https://codesandbox.io/s/leaflet-canvas-geojson-click-uy9ez
Usage:
The left map has preferCanvas: true, the right one has preferCanvas: false ;
on the right map you can click on italian regions triggering the event and see the region name in the top-right; on the left map this does not work.

Steps to Reproduce

  • create a map with the option preferCanvas: true
  • add some circles using LCircleMarker
  • add LGeoJson layer and set a mouse event (e.g. click) in the onEachFeature function using layer.on("eventname",fn).

Expected Results

The mouse event calls the callback

Actual Results

The mouse event won't trigger
(but it works fine with map option: preferCanvas: false)

Browsers Affected

Tested on:

  • [x ] Chrome
  • [x ] Firefox
    (but I guess all are affected)

Versions

  • Leaflet: v1.6.0
  • Vue: v2.6.11
  • Vue2Leaflet: v2.5.2

Similar issue (closed) : #358

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugconfirmedIssue is accepted as either a bug or a valid enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions