@@ -13,6 +13,7 @@ var d3 = require('d3');
13
13
var tinycolor = require ( 'tinycolor2' ) ;
14
14
15
15
var Plotly = require ( '../../plotly' ) ;
16
+ var Registry = require ( '../../registry' ) ;
16
17
var Lib = require ( '../../lib' ) ;
17
18
var svgTextUtils = require ( '../../lib/svg_text_utils' ) ;
18
19
var Color = require ( '../../components/color' ) ;
@@ -512,20 +513,23 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
512
513
Axes . doTicks ( gd , activeAxIds [ i ] , true ) ;
513
514
}
514
515
515
- function redrawObjs ( objArray , module ) {
516
- var obji ;
516
+ function redrawObjs ( objArray , method ) {
517
517
for ( i = 0 ; i < objArray . length ; i ++ ) {
518
- obji = objArray [ i ] ;
518
+ var obji = objArray [ i ] ;
519
+
519
520
if ( ( ew && activeAxIds . indexOf ( obji . xref ) !== - 1 ) ||
520
521
( ns && activeAxIds . indexOf ( obji . yref ) !== - 1 ) ) {
521
- module . draw ( gd , i ) ;
522
+ method ( gd , i ) ;
522
523
}
523
524
}
524
525
}
525
526
526
- redrawObjs ( fullLayout . annotations || [ ] , Plotly . Annotations ) ;
527
- redrawObjs ( fullLayout . shapes || [ ] , Plotly . Shapes ) ;
528
- redrawObjs ( fullLayout . images || [ ] , Plotly . Images ) ;
527
+ // annotations and shapes 'draw' method is slow,
528
+ // use the finer-grained 'drawOne' method instead
529
+
530
+ redrawObjs ( fullLayout . annotations || [ ] , Registry . getComponentMethod ( 'annotations' , 'drawOne' ) ) ;
531
+ redrawObjs ( fullLayout . shapes || [ ] , Registry . getComponentMethod ( 'shapes' , 'drawOne' ) ) ;
532
+ redrawObjs ( fullLayout . images || [ ] , Registry . getComponentMethod ( 'images' , 'draw' ) ) ;
529
533
}
530
534
531
535
function doubleClick ( ) {
0 commit comments