Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/marks/tip.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ export class Tip extends Mark {
text.setAttribute("y", `${+getLineOffset(a, text.childNodes.length, lineHeight).toFixed(6)}em`);
text.setAttribute("transform", `translate(${getTextTranslate(a, m, r, w, h)})`);
});
g.attr("visibility", null);
}

// Wait until the plot is inserted into the page so that we can use getBBox
Expand All @@ -250,8 +251,11 @@ export class Tip extends Mark {
// this step. Perhaps this could be done synchronously; getting the
// dimensions of the SVG is easy, and although accurate text metrics are
// hard, we could use approximate heuristics.
if (svg.isConnected) Promise.resolve().then(postrender);
else if (typeof requestAnimationFrame !== "undefined") requestAnimationFrame(postrender);
if (index.length) {
g.attr("visibility", "hidden"); // hide until postrender
if (svg.isConnected) Promise.resolve().then(postrender);
else if (typeof requestAnimationFrame !== "undefined") requestAnimationFrame(postrender);
}

return g.node();
}
Expand Down
4 changes: 2 additions & 2 deletions test/output/tipNewLines.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.