@@ -118,15 +118,18 @@ function drawOne(gd, index) {
118
118
. call ( Color . stroke , options . bordercolor )
119
119
. call ( Color . fill , options . bgcolor ) ;
120
120
121
+ var isSizeConstrained = options . width || options . height ;
122
+
121
123
var annClipID = 'clip' + fullLayout . _uid + '_ann' + index ;
122
124
var annTextClip = fullLayout . _defs . select ( '.clips' )
123
125
. selectAll ( '#' + annClipID )
124
- . data ( [ 0 ] ) ;
126
+ . data ( isSizeConstrained ? [ 0 ] : [ ] ) ;
125
127
126
128
annTextClip . enter ( ) . append ( 'clipPath' )
127
129
. classed ( 'annclip' , true )
128
130
. attr ( 'id' , annClipID )
129
131
. append ( 'rect' ) ;
132
+ annTextClip . exit ( ) . remove ( ) ;
130
133
131
134
var font = options . font ;
132
135
@@ -326,7 +329,7 @@ function drawOne(gd, index) {
326
329
x : borderfull + xShift - 1 ,
327
330
y : borderfull + yShift
328
331
} )
329
- . call ( Drawing . setClipUrl , annClipID ) ;
332
+ . call ( Drawing . setClipUrl , isSizeConstrained ? annClipID : null ) ;
330
333
}
331
334
else {
332
335
var texty = borderfull + yShift - anntextBB . top ,
@@ -335,7 +338,7 @@ function drawOne(gd, index) {
335
338
x : textx ,
336
339
y : texty
337
340
} )
338
- . call ( Drawing . setClipUrl , annClipID ) ;
341
+ . call ( Drawing . setClipUrl , isSizeConstrained ? annClipID : null ) ;
339
342
annText . selectAll ( 'tspan.line' ) . attr ( { y : texty , x : textx } ) ;
340
343
}
341
344
0 commit comments