Skip to content
This repository has been archived by the owner on Nov 19, 2018. It is now read-only.

Is this working on the latest leaflet? #6

Open
iamvitali opened this issue May 22, 2018 · 1 comment
Open

Is this working on the latest leaflet? #6

iamvitali opened this issue May 22, 2018 · 1 comment

Comments

@iamvitali
Copy link

iamvitali commented May 22, 2018

Hi,
Installed this with npm and using with import 'leaflet-canvas-marker/dist/leaflet.canvas-markers.js'; (because import 'leaflet-canvas-marker' doesn't do the trick for some reason).

I've added the canvas to the map:
this.mapMarkerLayer = L.canvasIconLayer({}).addTo(this.map);

And getting this error on zoom in and out:

screen shot 2018-05-22 at 6 56 09 pm

When I try to add markers to it L.marker([location.lat, location.long]).addTo(this.mapMarkerLayer).bindPopup(location.name);, I get this error:

screen shot 2018-05-22 at 6 53 37 pm

@Endebert
Copy link

@iamvitali I wanted to try this solution in my project as well, as I am struggling with performance (related to DOM updates in a Vue project).

I quickly converted it to es6, wasn't that difficult. Also fixed an error on mousemove if no markers have been added yet.

This is based on the master branch btw, here is the state if anyone cares: https://github.com/eJuke/Leaflet.Canvas-Markers/tree/d1e94ed4c222dfab7b7e1b1d4deb01f0a6fc811b

Keep in mind that you need to have rbush installed as an npm package, or adapt the import statement.

You can then use it like this:

import CanvasIconLayer from "./assets/Leaflet_extensions/CanvasIconLayer";
const canvasLayer = new CanvasIconLayer({});

Unfortunately, since there is no support for dragging markers, I can't really use it at this point.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants