mirror of
https://gitee.com/antv/g6.git
synced 2024-11-30 18:58:34 +08:00
correct tooltip test
This commit is contained in:
parent
5877b0f784
commit
c5e87183d1
@ -97,7 +97,7 @@
|
||||
"screenshot": "node ./bin/screenshot.js",
|
||||
"start": "npm run dev",
|
||||
"test": "torch --compile --renderer --recursive ./test/unit",
|
||||
"test-live": "torch --compile --interactive --watch --recursive ./test/unit",
|
||||
"test-live": "torch --compile --interactive --watch --recursive ./test/unit/plugins/tool.tooltip-spec.js",
|
||||
"watch": "webpack --config webpack-dev.config.js",
|
||||
"win-dev": "node ./bin/win-dev.js"
|
||||
},
|
||||
|
@ -68,7 +68,7 @@ class Plugin {
|
||||
init() {
|
||||
const graph = this.graph;
|
||||
graph.on('mouseenter', ev => {
|
||||
this.onMouseEnter(ev);
|
||||
ev.shape && this.onMouseEnter(ev);
|
||||
});
|
||||
graph.on('mousemove', ev => {
|
||||
this.onMouseMove(ev);
|
||||
@ -87,6 +87,9 @@ class Plugin {
|
||||
|
||||
if (tooltipHtml) {
|
||||
tooltip = Util.createDOM(tooltipHtml);
|
||||
tooltip.css({
|
||||
position: 'absolute'
|
||||
});
|
||||
graphContainer.appendChild(tooltip);
|
||||
} else {
|
||||
tooltip = null;
|
||||
@ -110,7 +113,7 @@ class Plugin {
|
||||
}
|
||||
onMouseLeave() {
|
||||
if (this.tooltip) {
|
||||
// this.tooltip.destroy();
|
||||
this.tooltip.destroy();
|
||||
this.tooltip = null;
|
||||
}
|
||||
}
|
||||
|
@ -11,9 +11,9 @@ document.body.appendChild(Util.createDOM(`
|
||||
|
||||
describe('tooltip test', () => {
|
||||
const tooltip = new Tooltip({
|
||||
getHtml({ item }) {
|
||||
getTooltip() {
|
||||
return `
|
||||
<div></div>
|
||||
<div>dddd</div>
|
||||
`;
|
||||
}
|
||||
});
|
||||
@ -39,4 +39,5 @@ describe('tooltip test', () => {
|
||||
plugins: [ tooltip ]
|
||||
});
|
||||
graph.read(data);
|
||||
graph.destroy();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user