@@ -3016,15 +3016,14 @@ axes.drawLabels = function(gd, ax, opts) {
3016
3016
}
3017
3017
3018
3018
ax . _hideOutOfRangeInsideTickLabels = undefined ;
3019
- if ( ( ax . ticklabelposition || '' ) . indexOf ( 'inside' ) !== - 1 && ax . _subplotsWith ) {
3019
+ if ( ( ax . ticklabelposition || '' ) . indexOf ( 'inside' ) !== - 1 ) {
3020
3020
ax . _hideOutOfRangeInsideTickLabels = function ( ) {
3021
3021
// hide inside tick labels that go outside axis end points
3022
+ var p0 = ax . l2p ( ax . _rl [ 0 ] ) ;
3023
+ var p1 = ax . l2p ( ax . _rl [ 1 ] ) ;
3022
3024
3023
- var gridLayer = fullLayout . _cartesianlayer
3024
- . select ( '.subplot.' + ax . _subplotsWith [ 0 ] ) // is it the best way to get?
3025
- . select ( '.gridlayer' ) ;
3026
-
3027
- var gridBb = Drawing . bBox ( gridLayer . node ( ) ) ;
3025
+ var min = Math . min ( p0 , p1 ) + ax . _offset ;
3026
+ var max = Math . max ( p0 , p1 ) + ax . _offset ;
3028
3027
3029
3028
var isX = ax . _id . charAt ( 0 ) === 'x' ;
3030
3029
@@ -3036,11 +3035,11 @@ axes.drawLabels = function(gd, ax, opts) {
3036
3035
var bb = Drawing . bBox ( thisLabel . node ( ) ) ;
3037
3036
var hide = false ;
3038
3037
if ( isX ) {
3039
- if ( bb . right > gridBb . right ) hide = true ;
3040
- else if ( bb . left < gridBb . left ) hide = true ;
3038
+ if ( bb . right > max ) hide = true ;
3039
+ else if ( bb . left < min ) hide = true ;
3041
3040
} else {
3042
- if ( bb . bottom > gridBb . bottom ) hide = true ;
3043
- else if ( bb . top < gridBb . top ) hide = true ;
3041
+ if ( bb . bottom > max ) hide = true ;
3042
+ else if ( bb . top < min ) hide = true ;
3044
3043
}
3045
3044
if ( hide ) thisLabel . select ( 'text' ) . style ( { opacity : 0 } ) ;
3046
3045
} // TODO: hide mathjax?
0 commit comments