Skip to content

Commit 5a4d005

Browse files
committed
Mirror changes from #878 and small typo fix
1 parent d6bbb74 commit 5a4d005

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/plots/cartesian/transition_axes.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
var d3 = require('d3');
1313

1414
var Plotly = require('../../plotly');
15+
var Registry = require('../../registry');
1516
var Lib = require('../../lib');
1617
var Axes = require('./axes');
1718
var axisRegex = /((x|y)([2-9]|[1-9][0-9]+)?)axis$/;
@@ -113,20 +114,23 @@ module.exports = function transitionAxes(gd, newLayout, transitionConfig, makeOn
113114
Axes.doTicks(gd, activeAxIds[i], true);
114115
}
115116

116-
function redrawObjs(objArray, module) {
117-
var obji;
117+
function redrawObjs(objArray, method) {
118118
for(i = 0; i < objArray.length; i++) {
119-
obji = objArray[i];
119+
var obji = objArray[i];
120+
120121
if((activeAxIds.indexOf(obji.xref) !== -1) ||
121122
(activeAxIds.indexOf(obji.yref) !== -1)) {
122-
module.drawOne(gd, i);
123+
method(gd, i);
123124
}
124125
}
125126
}
126127

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'));
130134
}
131135

132136
function unsetSubplotTransform(subplot) {

0 commit comments

Comments
 (0)