8000 replace Modebar.cleanup with removeAllButtons: · siqitech/plotly.js@18e09dc · GitHub
[go: up one dir, main page]

Skip to content

Commit 18e09dc

Browse files
committed
replace Modebar.cleanup with removeAllButtons:
- no need to remove entire modebar element when buttons need to be changed. - remove only child elements
1 parent 22a6f3b commit 18e09dc

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/components/modebar/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -460,12 +460,6 @@ proto.handleHoverGl2d = function(ev) {
460460
});
461461
};
462462

463-
proto.cleanup = function(){
464-
this.element.innerHTML = '';
465-
var modebarParent = this.element.parentNode;
466-
if (modebarParent) modebarParent.removeChild(this.element);
467-
};
468-
469463
proto.toImage = function() {
470464

471465
var format = 'png';
@@ -520,7 +514,13 @@ proto.sendDataToCloud = function() {
520514
Plotly.Plots.sendDataToCloud(gd);
521515
};
522516

523-
module.exports = ModeBar;
517+
proto.removeAllButtons = function() {
518+
while(this.element.firstChild) {
519+
this.element.removeChild(this.element.firstChild);
520+
}
521+
522+
this.hasLogo = false;
523+
};
524524
function createModebar(gd, buttons) {
525525
var fullLayout = gd._fullLayout;
526526

0 commit comments

Comments
 (0)
0