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

Enable Customize trigger function for Sensors #228

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Sannma7
Copy link

@Sannma7 Sannma7 commented Apr 22, 2021

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Apr 22, 2021

🦋 Changeset detected

Latest commit: 7486686

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@dnd-kit/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@clauderic
Copy link
Owner

clauderic commented Apr 26, 2021

Hey @Sannma7,

I'm a bit hesitant to merge this just because it's fairly straightforward for consumers to override the default activator of a sensor.

class MyPointerSensor extends PointerSensor {
  static activators = [
    {
      eventName: 'onPointerDown',
      handler: (
        {nativeEvent: event},
        options
      ) => {
        return true;
      },
    },
  ]
}

I'm also unclear how well this approach would scale for consumers if there were multiple activators defined for a given sensor.

@Sannma7
Copy link
Author

Sannma7 commented May 6, 2021

I did override the activator in this approach to make my sensor only triggered by a pen.
I opened this pr because I think it's more friendly to consumers to do this without having to dig into source code.

What about just export the AbstractPointerSensor?

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.

2 participants