Skip to content

Commit

Permalink
Merge pull request #12608 from plainheart/fix-12607
Browse files Browse the repository at this point in the history
fix(tooltip): added dispose method for rich tooltip, close #12607.
  • Loading branch information
pissang authored May 13, 2020
2 parents 79919e7 + 0a757f2 commit 1b02954
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/component/tooltip/TooltipRichContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,14 @@ TooltipRichContent.prototype = {
return this._show;
},

dispose: function () {
clearTimeout(this._hideTimeout);

if (this.el) {
this._zr.remove(this.el);
}
},

getOuterSize: function () {
var size = this.getSize();
return {
Expand Down
14 changes: 13 additions & 1 deletion test/tooltip-rich.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@
#main {
background: #fff;
}
#btn-dispose {
position: absolute;
left: 10px;
top: 10px;
z-index: 1;
}
</style>
<button type="button" id="btn-dispose">Dispose chart</button>
<div id="main"></div>
<script>

Expand Down Expand Up @@ -86,7 +93,12 @@
});

window.onresize = chart.resize;

// fix #12607: to dispose the rich tooltip
document.getElementById('btn-dispose').addEventListener('click', function () {
chart.dispose();
});
});
</script>
</body>
</html>
</html>

0 comments on commit 1b02954

Please sign in to comment.