IITC-CE / Leaflet.Canvas-Markers

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

Uncaught TypeError: Cannot read property 'getBounds' of null #6

Closed johnd0e closed 5 years ago

johnd0e commented 5 years ago
var isDisplaying = self._map.getBounds().contains(latlng);
VM12705:1885 Uncaught TypeError: Cannot read property 'getBounds' of null
    at NewClass.removeMarker (<anonymous>:1885:42)
    at NewClass.removeLayer (<anonymous>:1873:18)
    at <anonymous>:20331:21
    at Array.forEach (<anonymous>)
    at Object.removePortal (<anonymous>:20330:27)
    at window.Render.deletePortalEntity (<anonymous>:19154:22)
    at window.Render.clearPortalsOutsideBounds (<anonymous>:18974:12)
    at window.Render.startRenderPass (<anonymous>:18959:8)
    at window.MapDataRequest.refresh (<anonymous>:19710:15)
    at <anonymous>:19634:76
johnd0e commented 5 years ago

It's because we trying to process markers when ornaments layer is not on the map. I'm not sure if adding/removal should be processed in this case. If it should than perhaps we need keep _map property even when ornaments layer is turned off (possibly backing it up in mapToAdd property).

johnd0e commented 5 years ago

We've updated our user code, and this error seems don't occur anymore. Parent issue: #10.