Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0daa5d6

Browse filesBrowse files
authored
Merge pull request #878 from plotly/fixup-registry
Fixup cartesian dragbox module
2 parents 5b92305 + f10910f commit 0daa5d6
Copy full SHA for 0daa5d6

File tree

Expand file treeCollapse file tree

1 file changed

+11
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-7
lines changed

‎src/plots/cartesian/dragbox.js

Copy file name to clipboardExpand all lines: src/plots/cartesian/dragbox.js
+11-7Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ var d3 = require('d3');
1313
var tinycolor = require('tinycolor2');
1414

1515
var Plotly = require('../../plotly');
16+
var Registry = require('../../registry');
1617
var Lib = require('../../lib');
1718
var svgTextUtils = require('../../lib/svg_text_utils');
1819
var Color = require('../../components/color');
@@ -512,20 +513,23 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
512513
Axes.doTicks(gd, activeAxIds[i], true);
513514
}
514515

515-
function redrawObjs(objArray, module) {
516-
var obji;
516+
function redrawObjs(objArray, method) {
517517
for(i = 0; i < objArray.length; i++) {
518-
obji = objArray[i];
518+
var obji = objArray[i];
519+
519520
if((ew && activeAxIds.indexOf(obji.xref) !== -1) ||
520521
(ns && activeAxIds.indexOf(obji.yref) !== -1)) {
521-
module.draw(gd, i);
522+
method(gd, i);
522523
}
523524
}
524525
}
525526

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'));
529533
}
530534

531535
function doubleClick() {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.