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

a solution to prevent single click while double clicking #683

Conversation

moontrip
Copy link
Contributor

@moontrip moontrip commented Nov 29, 2023

This will possibly address the single click issue while double clicking a marker. Branched out from #588.

@moontrip moontrip requested a review from bobular November 29, 2023 03:35
Copy link
Member

@bobular bobular left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great* - debouncing is the way!

* note that testers will need to re-enable the multiple selection feature in MapAnalysis.tsx

@@ -335,7 +342,8 @@ export default function BoundsDriftMarker({
position={position}
// new way to handle mouse events
eventHandlers={{
click: (e: LeafletMouseEvent) => handleClick(e),
// debounce single click to be prevented when double clicking marker
click: (e: LeafletMouseEvent) => debounceSingleClick(e),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would save a few bytes! (same for the other handlers)

Suggested change
click: (e: LeafletMouseEvent) => debounceSingleClick(e),
click: debounceSingleClick,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bobular Thank you for your review and tests 👍 Yes they can be simplified as you noticed: thanks! I addressed your feedbacks and removed the console.log I made for test purpose.

@moontrip moontrip merged commit 64596db into multiple-marker-selection-simplified Nov 29, 2023
1 check passed
@moontrip moontrip deleted the prevent-single-click-when-double-clicking branch November 29, 2023 21:44
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

Successfully merging this pull request may close these issues.

2 participants