IITC-CE / Leaflet.Canvas-Markers

Leaflet plugin for displaying icons on canvas instead of DOM
MIT License
2 stars 4 forks source link

L.circleMarker not working #15

Closed md-seb closed 4 years ago

md-seb commented 4 years ago

I wanted to use L.circleMarker, but the plugin fails with

Uncaught TypeError: Cannot read property 'load' of undefined at leaflet.canvas-markers.js:386

I looked at the source but I don't see any code handling SVG markers. Am I missing anything?

johnd0e commented 4 years ago
  1. Current dev branch is https://github.com/IITC-CE/Leaflet.Canvas-Markers/tree/getevents
  2. L.CircleMarker is not relevant to this project at all. Only L.Marker is supported
md-seb commented 4 years ago

git clone git@github.com:IITC-CE/Leaflet.Canvas-Markers.git cd Leaflet.Canvas-Markers git checkout getevents npm install npm install leaflet npm run build cd dist cp leaflet.canvas-markers.js /roads-seb/libs/

see http://www.metdesk.com/roads-seb/libs/index.html

johnd0e commented 4 years ago

You must either preload rbush, or use leaflet.canvas-markers.standalone.js.

md-seb commented 4 years ago

using leaflet.canvas-markers.standalone.js makes no difference, see updated http://www.metdesk.com/roads-seb/libs/index.html

johnd0e commented 4 years ago

Ok, I see now. Change _full.js to

window.rbush = require("rbush");
var factory = require("./plugin/leaflet.canvas-markers");

window.L.CanvasIconLayer = factory(L);

Then build and use leaflet.canvas-markers.js.

For sample usage see updated index.html.