@@ -325,7 +325,7 @@ function updateShape(gd, index, opt, value) {
325325 plotinfo = plots [ subplots [ i ] ] ;
326326 clipAxes = subplots [ i ] ;
327327
328- if ( isShapeInSubplot ( gd , options , plotinfo . id ) ) {
328+ if ( isShapeInSubplot ( gd , options , plotinfo ) ) {
329329 drawShape ( plotinfo . shapelayer ) ;
330330 }
331331 }
@@ -362,10 +362,13 @@ function getShapeLayer(gd, index) {
362362 return shapeLayer ;
363363}
364364
365- function isShapeInSubplot ( gd , shape , subplot ) {
366- var xa = Plotly . Axes . getFromId ( gd , subplot , 'x' ) . _id ,
367- ya = Plotly . Axes . getFromId ( gd , subplot , 'y' ) . _id ;
368- return shape . layer === 'below' && ( xa === shape . xref || ya === shape . yref ) ;
365+ function isShapeInSubplot ( gd , shape , plotinfo ) {
366+ var xa = Plotly . Axes . getFromId ( gd , plotinfo . id , 'x' ) . _id ,
367+ ya = Plotly . Axes . getFromId ( gd , plotinfo . id , 'y' ) . _id ,
368+ isBelow = shape . layer === 'below' ,
369+ inSuplotAxis = ( xa === shape . xref || ya === shape . yref ) ,
370+ isNotAnOverlaidSubplot = ! ! plotinfo . shapelayer ;
371+ return isBelow && inSuplotAxis && isNotAnOverlaidSubplot ;
369372}
370373
371374function decodeDate ( convertToPx ) {
0 commit comments