Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double click detection #375

Closed
sedghi opened this issue Jan 18, 2023 · 2 comments
Closed

Double click detection #375

sedghi opened this issue Jan 18, 2023 · 2 comments
Assignees

Comments

@sedghi
Copy link
Member

sedghi commented Jan 18, 2023

Currently the double click on a viewport when an annotation tool is active will start the annotation/rendering loop which is not great since that means to App can run callbacks on double click.

There should be a timeout for the mouseDownlistener set so that a double click is distinguished from a single click. Since otherwise, the double click will be triggered as : single click (first click) + double click (when second click happens)

jbocce pushed a commit to jbocce/cornerstone3D-beta that referenced this issue Jan 23, 2023
Added a timeout in mouseDownListener to determine if a double click occurs.
If a double click occurs during the timeout,
then any mouse down and up events that occurred during the timeout are suppressed.
If the timeout expires, then the first mouse down and up events during the timeout
are fired and any browser double click event that might occur is suppressed/ignored.
Double clicks that occur during tool interaction are suppressed
Double click event capture phase listeners are used to more reliably suppress double clicks.
@jbocce
Copy link
Contributor

jbocce commented Jan 26, 2023

Related PR: #382

sedghi pushed a commit that referenced this issue Jan 26, 2023
* fix(mouseDownListener): Double click detection (#375)

Added a timeout in mouseDownListener to determine if a double click occurs.
If a double click occurs during the timeout,
then any mouse down and up events that occurred during the timeout are suppressed.
If the timeout expires, then the first mouse down and up events during the timeout
are fired and any browser double click event that might occur is suppressed/ignored.
Double clicks that occur during tool interaction are suppressed
Double click event capture phase listeners are used to more reliably suppress double clicks.

* Fixing syntax error in example-info.json.

* PR feedback: CS3D should not suppress a double click it has detected in
mouseDownListener - even during annotation creation. It is up to the any
listener of the dblclick event to decide how it should be handled.

* PR feedback - using a drag tolerance to help determine if a double click will not occur

* PR updates:

- code comments added and modified for clarification
- the double click listener to ignore double click events is now entirely
encapsulated in the mouseDownListener module
- better named variables in the unit tests
- better conversion of world CPU coordinates to Point3

* Added a TODO for the double click tolerance for touch devices.

* PR feedback - restored adding and removing the double click ignore listener
with other mouse events

* Adding the ignore double click listener back on the element.

* Adding and removing the ignore double click listener in the tools init
and destroy functions (respectively).
Double click drag tolerance is now a projected distance.
@jbocce jbocce closed this as completed Jan 27, 2023
@jbocce jbocce reopened this Feb 1, 2023
@jbocce
Copy link
Contributor

jbocce commented Feb 2, 2023

@jbocce jbocce closed this as completed Feb 2, 2023
@jbocce jbocce reopened this Feb 9, 2023
jbocce pushed a commit to jbocce/cornerstone3D-beta that referenced this issue Feb 9, 2023
… viewport element instead of the document element

CS3D issue cornerstonejs#375
sedghi pushed a commit that referenced this issue Feb 16, 2023
… viewport element instead of the document element (#429)

* fix(doubleClick): mouseDoubleClickIgnoreListener is now added to each viewport element instead of the document element
CS3D issue #375

* Clear the ignoreDoubleClick flag on the first mouse down of a potential
double click mouse down/up sequence.
Cleanup up listeners and double click state for every valid double click
that is detected in case only the second mouse down/up of the sequence was
received.
@jbocce jbocce closed this as completed Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants