From 01fc2a2d8f70d79710f0ee8a12ad3c660c54b0da Mon Sep 17 00:00:00 2001 From: ChitlangeSahas Date: Thu, 25 Mar 2021 14:56:47 -0700 Subject: [PATCH 1/3] fix: using onClick instead of mouseUp in SizedPlot.tsx --- giraffe/src/components/SizedPlot.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/giraffe/src/components/SizedPlot.tsx b/giraffe/src/components/SizedPlot.tsx index 037f30c9..8e24452c 100644 --- a/giraffe/src/components/SizedPlot.tsx +++ b/giraffe/src/components/SizedPlot.tsx @@ -120,12 +120,6 @@ export const SizedPlot: FunctionComponent = ({ bottom: 0, } - // for single clicking; using mouseup, since the onClick only gets through - // with a double click; and the hover and drag target does not use a mouse up; - // they are: hover: mouseEnter, mousemove, mouseleave - // drag target: mouseDown - // and every time there is a single click, the mouse goes up. so using that instead. - return (
= ({ left: `${margins.left}px`, cursor: `${userConfig.cursor || 'crosshair'}`, }} - onMouseUp={callbacks.singleClick} + onClick={callbacks.singleClick} onDoubleClick={memoizedResetDomains} {...hoverTargetProps} {...dragTargetProps} From 40c49672fdec51faa15cc3f511bd5b07987f2025 Mon Sep 17 00:00:00 2001 From: ChitlangeSahas Date: Thu, 25 Mar 2021 15:01:39 -0700 Subject: [PATCH 2/3] fix: test fix --- giraffe/src/components/SizedPlot.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/giraffe/src/components/SizedPlot.test.tsx b/giraffe/src/components/SizedPlot.test.tsx index 82f6e81c..30da7dcb 100644 --- a/giraffe/src/components/SizedPlot.test.tsx +++ b/giraffe/src/components/SizedPlot.test.tsx @@ -82,7 +82,7 @@ describe('the SizedPlot', () => { // when the user (for real) does a single click, then a mouse up happens. // choose mouse up because the single click listener wasn't triggering except on // double clicks - fireEvent.mouseUp(screen.getByTestId('giraffe-inner-plot')) + fireEvent.click(screen.getByTestId('giraffe-inner-plot')) expect(resetSpy).not.toHaveBeenCalled() expect(fakeSingleClickInteractionHandler).toHaveBeenCalled() From 79f8cc0df021d4ee538b56e7214af643d783eaf6 Mon Sep 17 00:00:00 2001 From: ChitlangeSahas Date: Thu, 25 Mar 2021 15:06:39 -0700 Subject: [PATCH 3/3] fix: test fix --- giraffe/src/components/SizedPlot.test.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/giraffe/src/components/SizedPlot.test.tsx b/giraffe/src/components/SizedPlot.test.tsx index 30da7dcb..7b5a994a 100644 --- a/giraffe/src/components/SizedPlot.test.tsx +++ b/giraffe/src/components/SizedPlot.test.tsx @@ -79,9 +79,6 @@ describe('the SizedPlot', () => { layerCanvasRef={layersRef} /> ) - // when the user (for real) does a single click, then a mouse up happens. - // choose mouse up because the single click listener wasn't triggering except on - // double clicks fireEvent.click(screen.getByTestId('giraffe-inner-plot')) expect(resetSpy).not.toHaveBeenCalled()