feat: Add onStart and onEnd props to control Select activation and provide event callbacks
Why
Selection doesn't provide enough activation control to be used for a wide range of applications. Some applications may want control over the modifier keys used, or even which mouse buttons activate the selection
Resolves #731
What
Expose onStart and onEnd props that provide selection event callbacks to the consumer. Also allows the consumer to control whether or not activation should begin.
Checklist
- [x] Documentation updated
- [x] Storybook entry added
- [x] Ready to be merged
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/pmndrs/drei/GGz42jddScXy99CSW9YZhYgiUQhk
✅ Preview: https://drei-git-fork-contactsimonwilson-feat-select-activation-pmndrs.vercel.app
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Latest deployment of this branch, based on commit 9a9e18ff270869de4c614c55d330d04ff3edcc56:
| Sandbox | Source |
|---|---|
| weathered-tree-wkokgn | Configuration |
| Ground reflections and video textures | Configuration |
| arc-x-pmndrs-colors | Configuration |
| Multi-select & edges (forked) | Issue #731 |
Really good change imo! Do I understand correctly that this keeps the current client-facing behaviour where shit is the key used to activate?
Really good change imo! Do I understand correctly that this keeps the current client-facing behaviour where shit is the key used to activate?
Yes, exactly. This maintains full backwards compatibility but allows consumers to override the shift behavior. Exposing it with a callback function that provides the event, allowing other event data to be used (such as controlling which mouse button is used, other modifiers, etc)
Converted back to draft because after more consideration, the API could be even more flexible (onStart/onEnd)
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Updated |
|---|---|---|---|
| drei | ✅ Ready (Inspect) | Visit Preview | Oct 20, 2022 at 9:00PM (UTC) |