@@ -49,7 +49,9 @@ function draw(gd) {
49
49
fullLayout . _shapeSubplotLayer . selectAll ( 'path' ) . remove ( ) ;
50
50
51
51
for ( var i = 0 ; i < fullLayout . shapes . length ; i ++ ) {
52
- drawOne ( gd , i ) ;
52
+ if ( fullLayout . shapes [ i ] . visible ) {
53
+ drawOne ( gd , i ) ;
54
+ }
53
55
}
54
56
55
57
// may need to resurrect this if we put text (LaTeX) in shapes
@@ -169,8 +171,6 @@ function updateShape(gd, index, opt, value) {
169
171
// TODO: clean this up and remove it.
170
172
if ( ! optionsIn ) return ;
171
173
172
- var oldRef = { xref : optionsIn . xref , yref : optionsIn . yref } ;
173
-
174
174
// alter the input shape as requested
175
175
var optionsEdit = { } ;
176
176
if ( typeof opt === 'string' && opt ) optionsEdit [ opt ] = value ;
@@ -182,7 +182,12 @@ function updateShape(gd, index, opt, value) {
182
182
Lib . nestedProperty ( optionsIn , k ) . set ( optionsEdit [ k ] ) ;
183
183
}
184
184
185
- var posAttrs = [ 'x0' , 'x1' , 'y0' , 'y1' ] ;
185
+ // return early in visible: false updates
186
+ if ( optionsIn . visible === false ) return ;
187
+
188
+ var oldRef = { xref : optionsIn . xref , yref : optionsIn . yref } ,
189
+ posAttrs = [ 'x0' , 'x1' , 'y0' , 'y1' ] ;
190
+
186
191
for ( i = 0 ; i < 4 ; i ++ ) {
187
192
var posAttr = posAttrs [ i ] ;
188
193
// if we don't have an explicit position already,
0 commit comments