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!: various drag-adjacent interfaces #7975

Merged
merged 3 commits into from
Mar 29, 2024

Conversation

BeksOmega
Copy link
Collaborator

@BeksOmega BeksOmega commented Mar 29, 2024

The basics

The details

Resolves

Fixes N/A

Proposed Changes

Fixes up the ISelectable and IDeletable interfaces to confirm to the proposed design. Also switches everything over to the new IDraggable interfaces. This is a breaking change because IDraggable classes are no longer required to be IDeletable as well.

Test Coverage

Manually tested that all the dragging and drag targets continue to work.

Documentation

N/A

Additional Information

N/A

Breaking changes / To fix

This change modifies the IDeleteable interface to add a dispose and a setDeleteStyle method. If you were implementing this interface, you should add those two methods. It is unlikely you were or should be implementing this interface, because there is no way to add new rendered elements to Blockly.

This change modifies the ISelectable interface to stop extending IDeletable or IMovable. If you were relying on calling selectable.isDeletable on an ISelectable you should change this to Blockly.isDeletable(selectable) && selectable.isDeletable(). The first call ensures that the block has an isDeletable method. If you were relying on calling selectable.isMovable on an ISelectable you should change this to Blockly.isDraggable(selectable) && selectable.isMovable(). The first call ensures that the block has an isMovable method.

@github-actions github-actions bot added breaking change Used to mark a PR or issue that changes our public APIs. PR: fix Fixes a bug labels Mar 29, 2024
@BeksOmega BeksOmega marked this pull request as ready for review March 29, 2024 18:03
@BeksOmega BeksOmega requested a review from a team as a code owner March 29, 2024 18:03
@@ -105,7 +108,9 @@ export function registerCopy() {
!workspace.options.readOnly &&
!Gesture.inProgress() &&
selected != null &&
isDeletable(selected) &&
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what it's doing, but this code feels weird: isDeletable(selected) && selected.isDeletable(). Without context I would have no idea what eat part of that is doing. Is there anything you can do with the name to make it clearer? Maybe implementsDeletable(selected) && selected.isDeletable()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now draggable, selectable, and deletable are inconsistent. Can you change all of them to implementsX?

If no because of other dependencies, better to have them consistently be isX.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the issue is we already have a bunch of type guards that are isX, so unless we want to break all of those we're going to have inconsistency anyway. Is it better to have a group of type guards be different or just the one?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, then revert to isDeletable.

@BeksOmega BeksOmega enabled auto-merge (squash) March 29, 2024 20:59
@BeksOmega BeksOmega merged commit abfbbbc into google:rc/v11.0.0 Mar 29, 2024
11 checks passed
@github-actions github-actions bot added breaking change Used to mark a PR or issue that changes our public APIs. PR: fix Fixes a bug and removed PR: fix Fixes a bug breaking change Used to mark a PR or issue that changes our public APIs. labels Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Used to mark a PR or issue that changes our public APIs. PR: fix Fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants