Skip to content

Commit

Permalink
fix(client): try to fix click handler in manhattan plot
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Jan 16, 2024
1 parent ac36c89 commit 6040d89
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions client/src/components/ManhattanPlot.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ const ManhattanPlot = React.memo(

bind: {
mouseup: (u, t, h) => e => {
console.debug("Manhattan plot received mouseup event:", e);
console.info("Manhattan plot received mouseup event:", e);
if (
onPointClick &&
e.button === 0 &&
Expand Down Expand Up @@ -252,7 +252,17 @@ const ManhattanPlot = React.memo(
textAlign: "center",
minHeight: height + 27 + 16, // plot height + title height (27 in Firefox) + top padding
}} {...props}>
<UplotReact options={uPlotOptions} data={finalData} />
<UplotReact options={uPlotOptions} data={finalData} onCreate={(u) => {
Array.from(u.root.querySelectorAll(".u-cursor-pt")).forEach((pt) => {
// Should be only one u-cursor-pt, so don't do any series index logic
pt.addEventListener("click", (e) => {
console.info("Manhattan plot u-cursor-pt received click event:", e);
if (onPointClick && e.button === 0 && hoveredItem.current && !u.cursor.drag.x) {
onPointClick(dataNoNulls[hoveredItem.current]);
}
});
});
}} />
<em style={{color: "#888"}}>
Click on a point to see more information about a particular peak.
Click and drag to zoom in on a region. Double-click to reset.
Expand Down

0 comments on commit 6040d89

Please sign in to comment.