Skip to content

Adding onStartDrag callback #74

@dfish13

Description

@dfish13

I thought it would be useful to add an onStartDrag(square) prop that is called whenever the user initiates a drag for a piece. For example it would help with highlighting the available moves when a user grabs a piece. And maybe an onStopDrag too!

I tried to use allowDrag to achieve this effect but for some reason allowDrag is called many times after a piece is dropped. When I added logic to compute available moves and change squareStyles for those squares in the allowDrag function it ended up calling allowDrag even more times and crashing the component. So I guess allowDrag was not designed to be used this way and I don't really understand why it gets called so many times.

I would be happy to work on this issue since I use this library on a personal project : )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions