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

Add support for pointer events to pc-entity #67

Merged
merged 6 commits into from
Dec 7, 2024
Merged

Conversation

willeastcott
Copy link
Contributor

@willeastcott willeastcott commented Dec 6, 2024

Add support for the following pointer events to the pc-entity element:

  • pointerdown
  • pointerup
  • pointermove
  • pointerenter
  • pointerleave

You can do:

<pc-entity onpointerdown="console.log('clicked!')"></pc-entity>

Or:

const entity = document.getElementById('my-entity');
entity.addEventListener('pointerdown', (e) => {
    console.log('clicked!');
});

@willeastcott willeastcott added the enhancement New feature or request label Dec 6, 2024
@willeastcott willeastcott self-assigned this Dec 6, 2024
@willeastcott willeastcott merged commit aaa7839 into main Dec 7, 2024
2 checks passed
@willeastcott willeastcott deleted the pointer-events branch December 7, 2024 11:18
@marklundin
Copy link
Member

It would be awesome to also have event bubbling here and set the event handle on parent entities

@willeastcott
Copy link
Contributor Author

It would be awesome to also have event bubbling here and set the event handle on parent entities

Agreed. I'll do that in a follow up PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants