[go: nahoru, domu]

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

fix: draggable interface and concrete dragger #7967

Merged
merged 4 commits into from
Mar 28, 2024

Conversation

BeksOmega
Copy link
Collaborator

The basics

The details

Resolves

Fixes N/A

Proposed Changes + reasons

This refactors the implementation to match the agreed upon design with two changes:

  1. Draggables won't take in IDragTarget objects. I don't know why I did that, since the dragger handles all interaction with drag targets.
  2. We have a new moveToStart method that is (essentially) used to cancel a drag in the case that the IDragTarget returns true for shouldPreventMove. Before we were just moving the block back to the original coordinates, but that doesn't allow blocks to reattach to parents or children.

The agreed upon design has a good separation of concerns between the draggable and the dragger. Giving the draggable responsibility over handling drag targets confuses that, and breaks the single responsibility principle. It also makes it more likely for an external developer to handle the drag targets incorrectly, because there is some fiddliness about the order methods shouldb e called in.

Test Coverage

Manually tested this with following PRs.

Documentation

Yes this will all need docs. May end up happening after the v11 release though =(

Additional Information

N/A

@github-actions github-actions bot added the PR: fix Fixes a bug label Mar 28, 2024
@BeksOmega BeksOmega marked this pull request as ready for review March 28, 2024 16:12
@BeksOmega BeksOmega requested a review from a team as a code owner March 28, 2024 16:12
core/interfaces/i_draggable.ts Outdated Show resolved Hide resolved
core/dragging/dragger.ts Show resolved Hide resolved
core/dragging/dragger.ts Show resolved Hide resolved
@BeksOmega BeksOmega merged commit 6fe080b into google:rc/v11.0.0 Mar 28, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: fix Fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants