Skip to content

Commit 3408b1e

Browse files
committed
mapbox: don't try to emit 'plotly_relayout' after map.remove()
- see http://codepen.io/etpinard/pen/ZBabVW for explanation - this removes the 'gd.emit is not a function' failures on 'npm run citest-jasmine'
1 parent 18a836d commit 3408b1e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/plots/mapbox/mapbox.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {
126126

127127
// keep track of pan / zoom in user layout and emit relayout event
128128
map.on('moveend', function(eventData) {
129+
if(!self.map) return;
130+
129131
var view = self.getView();
130132

131133
opts._input.center = opts.center = view.center;
@@ -358,7 +360,10 @@ proto.updateLayers = function() {
358360
};
359361

360362
proto.destroy = function() {
361-
if(this.map) this.map.remove();
363+
if(this.map) {
364+
this.map.remove();
365+
this.map = null;
366+
}
362367
this.container.removeChild(this.div);
363368
};
364369

0 commit comments

Comments
 (0)