Skip to content

Commit 2261a39

Browse files
committed
fix lineHeight
1 parent 6bccc91 commit 2261a39

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/marks/tooltip.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export class Tooltip extends Mark {
192192
const cy = (/^top-/.test(c) ? fitTop || !fitBottom : fitTop && !fitBottom) ? "top" : "bottom";
193193
c = `${cy}-${cx}`;
194194
}
195-
const oy = getLineOffset(c, text) * lineHeight;
195+
const oy = getLineOffset(c, text, lineHeight);
196196
tspan.attr("y", (d, i) => `${i * lineHeight + oy}em`);
197197
path.attr("d", getPath(c, m, r, w, h));
198198
content.attr("transform", getTextTransform(c, m, r, w, h));
@@ -280,8 +280,8 @@ function getSource2(channels, key) {
280280
return key === "x1" ? getSource(channels, "x2") : key === "y1" ? getSource(channels, "y2") : null;
281281
}
282282

283-
function getLineOffset(anchor, text) {
284-
return /^top-/.test(anchor) ? 0.94 : 0.71 - text.length;
283+
function getLineOffset(anchor, text, lineHeight) {
284+
return /^top-/.test(anchor) ? 0.94 : -0.29 - (text.length - 1) * lineHeight;
285285
}
286286

287287
function getTextTransform(anchor, m, r, width) {

0 commit comments

Comments
 (0)