@remix/mapbox-gl-draw
Advanced tools
Comparing version 1.4.3 to 1.4.4
{ | ||
"name": "@remix/mapbox-gl-draw", | ||
"version": "1.4.3", | ||
"version": "1.4.4", | ||
"description": "A drawing component for Mapbox GL JS", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/remix/mapbox-gl-draw", |
@@ -15,3 +15,6 @@ const events = require('./events'); | ||
// Stop connect attempt in the event that control is removed before map is loaded | ||
if (ctx.map) ctx.map.off('load', setup.connect); | ||
if (ctx.map) { | ||
ctx.map.off('load', setup.connect); | ||
ctx.map.off('render', setup.connect); | ||
} | ||
clearInterval(mapLoadedInterval); | ||
@@ -34,3 +37,8 @@ | ||
connect: function() { | ||
// If we call this function because of a `render` event, `loaded()` is | ||
// not guaranteed to be true. | ||
if (!ctx.map.loaded()) return; | ||
ctx.map.off('load', setup.connect); | ||
ctx.map.off('render', setup.connect); | ||
clearInterval(mapLoadedInterval); | ||
@@ -75,2 +83,3 @@ setup.addLayers(); | ||
map.on('load', setup.connect); | ||
map.on('render', setup.connect); | ||
mapLoadedInterval = setInterval(() => { if (map.loaded()) setup.connect(); }, 16); | ||
@@ -77,0 +86,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
3345025
50409