Skip to content

Commit

Permalink
fix(tooltip): added dispose method for rich tooltip, close apache#12607.
Browse files Browse the repository at this point in the history
  • Loading branch information
plainheart committed May 11, 2020
1 parent 5c245bc commit 0a757f2
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
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
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 0a757f2

Please sign in to comment.