@@ -100,7 +100,23 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo
100100 var updatedAxisIds = Object . keys ( updates ) ;
101101 var affectedSubplots = computeAffectedSubplots ( fullLayout , updatedAxisIds , updates ) ;
102102
103+ function updateLayoutObjs ( ) {
104+ function redrawObjs ( objArray , method , shortCircuit ) {
105+ for ( var i = 0 ; i < objArray . length ; i ++ ) {
106+ method ( gd , i ) ;
107+
108+ // once is enough for images (which doesn't use the `i` arg anyway)
109+ if ( shortCircuit ) return ;
110+ }
111+ }
112+
113+ redrawObjs ( fullLayout . annotations || [ ] , Registry . getComponentMethod ( 'annotations' , 'drawOne' ) ) ;
114+ redrawObjs ( fullLayout . shapes || [ ] , Registry . getComponentMethod ( 'shapes' , 'drawOne' ) ) ;
115+ redrawObjs ( fullLayout . images || [ ] , Registry . getComponentMethod ( 'images' , 'draw' ) , true ) ;
116+ }
117+
103118 if ( ! affectedSubplots . length ) {
119+ updateLayoutObjs ( ) ;
104120 return false ;
105121 }
106122
@@ -114,23 +130,23 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo
114130 Axes . doTicks ( gd , activeAxIds [ i ] , true ) ;
115131 }
116132
117- function redrawObjs ( objArray , method ) {
133+ function redrawObjs ( objArray , method , shortCircuit ) {
118134 for ( i = 0 ; i < objArray . length ; i ++ ) {
119135 var obji = objArray [ i ] ;
120136
121137 if ( ( activeAxIds . indexOf ( obji . xref ) !== - 1 ) ||
122138 ( activeAxIds . indexOf ( obji . yref ) !== - 1 ) ) {
123139 method ( gd , i ) ;
124140 }
141+
142+ // once is enough for images (which doesn't use the `i` arg anyway)
143+ if ( shortCircuit ) return ;
125144 }
126145 }
127146
128- // annotations and shapes 'draw' method is slow,
129- // use the finer-grained 'drawOne' method instead
130-
131147 redrawObjs ( fullLayout . annotations || [ ] , Registry . getComponentMethod ( 'annotations' , 'drawOne' ) ) ;
132148 redrawObjs ( fullLayout . shapes || [ ] , Registry . getComponentMethod ( 'shapes' , 'drawOne' ) ) ;
133- redrawObjs ( fullLayout . images || [ ] , Registry . getComponentMethod ( 'images' , 'draw' ) ) ;
149+ redrawObjs ( fullLayout . images || [ ] , Registry . getComponentMethod ( 'images' , 'draw' ) , true ) ;
134150 }
135151
136152 function unsetSubplotTransform ( subplot ) {
@@ -202,7 +218,6 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo
202218
203219 ticksAndAnnotations ( subplot . xaxis , subplot . yaxis ) ;
204220
205-
206221 var xa2 = subplot . xaxis ;
207222 var ya2 = subplot . yaxis ;
208223
0 commit comments