Skip to content

Commit 4d21b0c

Browse files
committed
Refactor History.tsx in frontend to work with D3 JS v7
1 parent 2a544f6 commit 4d21b0c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/app/components/StateRoute/History.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint-disable react-hooks/exhaustive-deps */
2+
/* eslint-disable */
23
// @ts-nocheck
34
import React, { useEffect } from 'react';
45
// formatting findDiff return data to show the changes with colors, aligns with actions.tsx
@@ -182,7 +183,8 @@ function History(props: Record<string, unknown>): JSX.Element {
182183
dispatch(changeSlider(d.data.index));
183184
})
184185
// added to display state change information to node tree
185-
.on('mouseover', (d) => {
186+
.on('mouseover', (event, d) => {
187+
const [x, y] = d3.pointer(event);
186188
// created popup div and appended it to display div(returned in this function)
187189
// D3 doesn't utilize z-index for priority,
188190
// rather decides on placement by order of rendering
@@ -192,8 +194,8 @@ function History(props: Record<string, unknown>): JSX.Element {
192194
.select('.display')
193195
.append('div')
194196
.attr('class', 'tooltip')
195-
.style('left', `${d3.event.pageX}px`)
196-
.style('top', `${d3.event.pageY}px`);
197+
.style('left', `${x}px`)
198+
.style('top', `${y}px`);
197199
d3.selectAll('.tooltip').html(findDiff(d.data.index));
198200
})
199201
.on('mouseout', (d) => {

0 commit comments

Comments
 (0)