Skip to content

Commit e0e79b4

Browse files
authored
Merge pull request #6679 from plotly/eraseActiveShape-command
add `Plotly.deleteActiveShape` command
2 parents 149c895 + 5c9a7c9 commit e0e79b4

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

draftlogs/6679_add.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- add Plotly.deleteActiveShape command [[#6679](https://github.com/plotly/plotly.js/pull/6679)]

src/components/shapes/draw.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ function eraseActiveShape(gd) {
669669

670670
delete gd._fullLayout._activeShapeIndex;
671671

672-
Registry.call('_guiRelayout', gd, {
672+
return Registry.call('_guiRelayout', gd, {
673673
shapes: list
674674
});
675675
}

src/plot_api/index.js

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ exports.deleteFrames = main.deleteFrames;
2424
exports.animate = main.animate;
2525
exports.setPlotConfig = main.setPlotConfig;
2626

27+
var getGraphDiv = require('../lib/dom').getGraphDiv;
28+
var eraseActiveShape = require('../components/shapes/draw').eraseActiveShape;
29+
exports.deleteActiveShape = function(gd) {
30+
return eraseActiveShape(getGraphDiv(gd));
31+
};
32+
2733
exports.toImage = require('./to_image');
2834
exports.validate = require('./validate');
2935
exports.downloadImage = require('../snapshot/download');

0 commit comments

Comments
 (0)