Skip to content

Commit 7f99ee7

Browse files
changed behaviour from removeLayer to setOptions
1 parent e0ab8fd commit 7f99ee7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/traces/scattermapbox/plot.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,13 @@ proto.addLayer = function(k, opts, below) {
8686
return mbLayer.id === currentLayerId;
8787
});
8888
if(layerExist && layerExist.length) {
89-
this.subplot.map.removeLayer(currentLayerId);
89+
this.subplot.setOptions(currentLayerId, 'setLayoutProperty', source.layout);
90+
if(source.layout.visibility === 'visible') {
91+
this.subplot.setOptions(currentLayerId, 'setPaintProperty', source.paint);
92+
}
93+
} else {
94+
this.subplot.addLayer(source, below);
9095
}
91-
this.subplot.addLayer(source, below);
9296
};
9397

9498
proto.update = function update(calcTrace) {

0 commit comments

Comments
 (0)