@@ -325,7 +325,7 @@ function updateShape(gd, index, opt, value) {
325
325
plotinfo = plots [ subplots [ i ] ] ;
326
326
clipAxes = subplots [ i ] ;
327
327
328
- if ( isShapeInSubplot ( gd , options , plotinfo . id ) ) {
328
+ if ( isShapeInSubplot ( gd , options , plotinfo ) ) {
329
329
drawShape ( plotinfo . shapelayer ) ;
330
330
}
331
331
}
@@ -362,10 +362,13 @@ function getShapeLayer(gd, index) {
362
362
return shapeLayer ;
363
363
}
364
364
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 ;
369
372
}
370
373
371
374
function decodeDate ( convertToPx ) {
0 commit comments