Skip to content

Commit

Permalink
Clear hover on mouseleave
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Oct 27, 2023
1 parent d0dab28 commit 824c5b0
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,16 @@ const LinearGenomeView = observer(({ model }: { model: LGV }) => {
<div
className={classes.rel}
ref={ref}
onMouseLeave={() => session.setHovered(undefined)}
onMouseMove={event => {
const c = ref.current
if (!c) {
return
}
const hoverPosition = model.pxToBp(
event.clientX - c.getBoundingClientRect().left,
)
const hoverFeature = model.tracks.find(
t => t.displays[0].featureUnderMouse,
)
const { tracks } = model
const leftPx = event.clientX - c.getBoundingClientRect().left
const hoverPosition = model.pxToBp(leftPx)
const hoverFeature = tracks.find(t => t.displays[0].featureUnderMouse)
session.setHovered({ hoverPosition, hoverFeature })
}}
>
Expand Down

0 comments on commit 824c5b0

Please sign in to comment.