drei icon indicating copy to clipboard operation
drei copied to clipboard

feat: Add onStart and onEnd props to control Select activation and provide event callbacks

Open techfoundrynz opened this issue 4 years ago • 7 comments

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

techfoundrynz avatar Feb 16 '22 11:02 techfoundrynz

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

vercel[bot] avatar Feb 16 '22 11:02 vercel[bot]

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

codesandbox-ci[bot] avatar Feb 16 '22 11:02 codesandbox-ci[bot]

Really good change imo! Do I understand correctly that this keeps the current client-facing behaviour where shit is the key used to activate?

gsimone avatar Feb 16 '22 11:02 gsimone

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)

techfoundrynz avatar Feb 16 '22 11:02 techfoundrynz

Converted back to draft because after more consideration, the API could be even more flexible (onStart/onEnd)

techfoundrynz avatar Feb 17 '22 09:02 techfoundrynz

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)

vercel[bot] avatar Oct 20 '22 20:10 vercel[bot]