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

Implement Pointer Events Context for Enhanced Interaction Handling #28

Merged
merged 6 commits into from
Jan 8, 2025

Conversation

marklundin
Copy link
Member

Optimizes the Picker to only run when a onPointer* prop is passed to a child entity. This should improve performance for non interactive apps

  • Introduced a new PointerEventsContext to manage pointer event registrations across components.
  • Updated Application.tsx to provide the PointerEventsContext to child components.
  • Modified Entity.tsx to utilize the context for adding and removing pointer event listeners dynamically.
  • Enhanced usePicker utility to check for registered pointer events before processing interactions.

These changes improve the handling of pointer events, allowing for more flexible and efficient interaction management within the application.

- Introduced a new `PointerEventsContext` to manage pointer event registrations across components.
- Updated `Application.tsx` to provide the `PointerEventsContext` to child components.
- Modified `Entity.tsx` to utilize the context for adding and removing pointer event listeners dynamically.
- Enhanced `usePicker` utility to check for registered pointer events before processing interactions.

These changes improve the handling of pointer events, allowing for more flexible and efficient interaction management within the application.
@marklundin marklundin added the enhancement New feature or request label Dec 23, 2024
@marklundin marklundin self-assigned this Dec 23, 2024
- Added `PointerEventsProvider` to manage registered pointer events and provide context to child components.
- Updated `picker.tsx` to include the new provider, improving interaction handling by enabling dynamic event registration.
- Refactored existing logic to utilize the `PointerEventsContext`, enhancing the flexibility of pointer event management.

These changes improve the overall interaction capabilities within the application.
…ent handling

- Updated the `usePicker` utility to accept a `pointerEvents` parameter, allowing for more dynamic interaction management.
- Modified the `Application` component to correctly utilize the updated `usePicker` function, ensuring pointer events are registered and processed efficiently.
- Reorganized the context providers in `Application` for better clarity and structure.
- Updated the Entity component to accept pointer event handlers as props instead of defaulting to no-ops.
- Added conditional checks to register and unregister pointer event listeners only if the corresponding handlers are provided.
- This change enhances flexibility and allows for more dynamic interaction management within the Entity component.
@marklundin marklundin merged commit f373b34 into main Jan 8, 2025
1 check passed
@marklundin marklundin deleted the feat-picker-optimization branch January 8, 2025 11:29
@marklundin marklundin restored the feat-picker-optimization branch January 8, 2025 13:46
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.

1 participant