@@ -1828,6 +1828,7 @@ axes.doTicks = function(gd, axid, skipTitle) {
18281828 if ( ! ax . showticklabels || ! isNumeric ( position ) ) {
18291829 tickLabels . remove ( ) ;
18301830 drawAxTitle ( ) ;
1831+ calcBoundingBox ( ) ;
18311832 return ;
18321833 }
18331834
@@ -1993,23 +1994,43 @@ axes.doTicks = function(gd, axid, skipTitle) {
19931994 }
19941995
19951996 function calcBoundingBox ( ) {
1996- var bBox = container . node ( ) . getBoundingClientRect ( ) ;
1997- var gdBB = gd . getBoundingClientRect ( ) ;
1998-
1999- /*
2000- * the way we're going to use this, the positioning that matters
2001- * is relative to the origin of gd. This is important particularly
2002- * if gd is scrollable, and may have been scrolled between the time
2003- * we calculate this and the time we use it
2004- */
2005- ax . _boundingBox = {
2006- width : bBox . width ,
2007- height : bBox . height ,
2008- left : bBox . left - gdBB . left ,
2009- right : bBox . right - gdBB . left ,
2010- top : bBox . top - gdBB . top ,
2011- bottom : bBox . bottom - gdBB . top
2012- } ;
1997+ if ( ax . showticklabels ) {
1998+ var gdBB = gd . getBoundingClientRect ( ) ;
1999+ var bBox = container . node ( ) . getBoundingClientRect ( ) ;
2000+
2001+ /*
2002+ * the way we're going to use this, the positioning that matters
2003+ * is relative to the origin of gd. This is important particularly
2004+ * if gd is scrollable, and may have been scrolled between the time
2005+ * we calculate this and the time we use it
2006+ */
2007+
2008+ ax . _boundingBox = {
2009+ width : bBox . width ,
2010+ height : bBox . height ,
2011+ left : bBox . left - gdBB . left ,
2012+ right : bBox . right - gdBB . left ,
2013+ top : bBox . top ,
2014+ bottom : bBox . bottom
2015+ } ;
2016+ } else {
2017+ var gs = fullLayout . _size ;
2018+ var pos ;
2019+
2020+ // set dummy bbox for ticklabel-less axes
2021+
2022+ if ( axLetter === 'x' ) {
2023+ pos = ax . anchor === 'free' ?
2024+ gs . t + gs . h * ( 1 - ax . position ) :
2025+ gs . t + gs . h * ( 1 - ax . _anchorAxis . domain [ { bottom : 0 , top : 1 } [ ax . side ] ] ) ;
2026+ ax . _boundingBox = { top : pos , bottom : pos } ;
2027+ } else {
2028+ pos = ax . anchor === 'free' ?
2029+ gs . l + gs . w * ax . position :
2030+ gs . l + gs . w * ax . _anchorAxis . domain [ { left : 0 , right : 1 } [ ax . side ] ] ;
2031+ ax . _boundingBox = { left : pos , right : pos } ;
2032+ }
2033+ }
20132034
20142035 /*
20152036 * for spikelines: what's the full domain of positions in the
0 commit comments