|
12 | 12 | var d3 = require('d3'); |
13 | 13 |
|
14 | 14 | var Plotly = require('../../plotly'); |
| 15 | +var Registry = require('../../registry'); |
15 | 16 | var Lib = require('../../lib'); |
16 | 17 | var Axes = require('./axes'); |
17 | 18 | var axisRegex = /((x|y)([2-9]|[1-9][0-9]+)?)axis$/; |
@@ -113,20 +114,23 @@ module.exports = function transitionAxes(gd, newLayout, transitionConfig, makeOn |
113 | 114 | Axes.doTicks(gd, activeAxIds[i], true); |
114 | 115 | } |
115 | 116 |
|
116 | | - function redrawObjs(objArray, module) { |
117 | | - var obji; |
| 117 | + function redrawObjs(objArray, method) { |
118 | 118 | for(i = 0; i < objArray.length; i++) { |
119 | | - obji = objArray[i]; |
| 119 | + var obji = objArray[i]; |
| 120 | + |
120 | 121 | if((activeAxIds.indexOf(obji.xref) !== -1) || |
121 | 122 | (activeAxIds.indexOf(obji.yref) !== -1)) { |
122 | | - module.drawOne(gd, i); |
| 123 | + method(gd, i); |
123 | 124 | } |
124 | 125 | } |
125 | 126 | } |
126 | 127 |
|
127 | | - redrawObjs(fullLayout.annotations || [], Plotly.Annotations); |
128 | | - redrawObjs(fullLayout.shapes || [], Plotly.Shapes); |
129 | | - redrawObjs(fullLayout.images || [], Plotly.Images); |
| 128 | + // annotations and shapes 'draw' method is slow, |
| 129 | + // use the finer-grained 'drawOne' method instead |
| 130 | + |
| 131 | + redrawObjs(fullLayout.annotations || [], Registry.getComponentMethod('annotations', 'drawOne')); |
| 132 | + redrawObjs(fullLayout.shapes || [], Registry.getComponentMethod('shapes', 'drawOne')); |
| 133 | + redrawObjs(fullLayout.images || [], Registry.getComponentMethod('images', 'draw')); |
130 | 134 | } |
131 | 135 |
|
132 | 136 | function unsetSubplotTransform(subplot) { |
|
0 commit comments