Skip to content

fix(core): onClick callback does not handle dblclick - #9629

Merged
felixpalmer merged 7 commits into
visgl:masterfrom
w1nklr:dblclick
Jun 10, 2025
Merged

felixpalmer merged 7 commits into
visgl:masterfrom
w1nklr:dblclick

Conversation

@w1nklr

@w1nklr w1nklr commented May 13, 2025

Copy link
Copy Markdown
Contributor

Let onClick callback handle double click as before v9.1.

Closes #9627

Change List

  • add an event handler for dblclick calling onClick callback.

Let onClick callback handle double click as before v9.1.
Done by adding a event handler for dblclick calling onClick.
@w1nklr
w1nklr marked this pull request as ready for review May 13, 2025 08:50
@w1nklr

w1nklr commented May 20, 2025

Copy link
Copy Markdown
Contributor Author

Is there anyone to have a look, or tell me how to proceed ?

Thanks.

@felixpalmer
felixpalmer requested a review from Pessimistress June 2, 2025 13:24
@felixpalmer

Copy link
Copy Markdown
Collaborator

@w1nklr does your solution let the developer distinguish a double from a single click?

@felixpalmer

Copy link
Copy Markdown
Collaborator

@Pessimistress I can verify this does indeed provide an event for the second click of the double-click, any reason not to merge?

@w1nklr

w1nklr commented Jun 2, 2025

Copy link
Copy Markdown
Contributor Author

@w1nklr does your solution let the developer distinguish a double from a single click?

Yes. the event holds a tapCount which is 1 for single clicks and 2 for double clicks.

@felixpalmer

Copy link
Copy Markdown
Collaborator

You have a failing test

w1nklr and others added 2 commits June 5, 2025 10:37
Update the test to account that a double click does now trigger onClick callback.
@w1nklr

w1nklr commented Jun 5, 2025

Copy link
Copy Markdown
Contributor Author

I updated the failing test to account that a double click does now trigger the onClick callback.

// Trigger onDragStart event
widgetManager.onEvent(pickedInfo, {type: 'panstart'});
// Event not defined
// Trigger onClick event

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// Trigger onClick event
// Trigger dblclick event

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Actually, it's the same callback onClick() that gets triggered, both by simple click and double click.
That's why I added this comment.

So either we should update all the comments to:
// Trigger click event (resp. dblClick, dragStart...)
or
// Trigger onClick() callback (resp. onClick, onDragStart)

@felixpalmer What do you prefer ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I updated the comments

// Trigger onDragStart event
widgetManager.onEvent(pickedInfo, {type: 'panstart'});
// Event not defined
// Trigger onClick event

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// Trigger onClick event
// Trigger dblclick event

@coveralls

coveralls commented Jun 5, 2025 •

Copy link
Copy Markdown

Coverage Status

coverage: 91.675% (-0.004%) from 91.679%
when pulling 6f79953 on w1nklr:dblclick
into 58c9097 on visgl:master.

@felixpalmer
felixpalmer merged commit 8d15962 into visgl:master Jun 10, 2025
@w1nklr
w1nklr deleted the dblclick branch June 16, 2025 07:42
@chrisgervang chrisgervang changed the title fix: onClick callback does not handle dblclick fix(core): onClick callback does not handle dblclick Sep 16, 2025
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.

[Bug] double click not handled by onClick callback

3 participants