Skip to content

Commit 9b96335

Browse files
committed
shorter
1 parent 9c26f10 commit 9b96335

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/marks/tooltip.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,17 @@ export class Tooltip extends Mark {
4444
const [xp, yp] = pointer(event);
4545
let ri = maxRadius * maxRadius;
4646
for (const index of indexes) {
47-
const oxj = fx(index.fx) - marginLeft;
48-
const oyj = fy(index.fy) - marginTop;
47+
const fxj = index.fx;
48+
const fyj = index.fy;
49+
const oxj = fx(fxj) - marginLeft;
50+
const oyj = fy(fyj) - marginTop;
4951
for (const j of index) {
5052
const xj = X[j] + oxj;
5153
const yj = Y[j] + oyj;
5254
const dx = xj - xp;
5355
const dy = yj - yp;
5456
const rj = dx * dx + dy * dy;
55-
if (rj <= ri) (i = j), (ri = rj), (xi = xj), (yi = yj), (fxi = index.fx), (fyi = index.fy);
57+
if (rj <= ri) (i = j), (ri = rj), (xi = xj), (yi = yj), (fxi = fxj), (fyi = fyj);
5658
}
5759
}
5860
}

0 commit comments

Comments
 (0)