-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
fix!: various drag-adjacent interfaces #7975
Conversation
d381540
to
6106214
Compare
@@ -105,7 +108,9 @@ export function registerCopy() { | |||
!workspace.options.readOnly && | |||
!Gesture.inProgress() && | |||
selected != null && | |||
isDeletable(selected) && |
There was a problem hiding this comment.
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()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
.
59d9e5b
to
6106214
Compare
The basics
The details
Resolves
Fixes N/A
Proposed Changes
Fixes up the
ISelectable
andIDeletable
interfaces to confirm to the proposed design. Also switches everything over to the newIDraggable
interfaces. This is a breaking change becauseIDraggable
classes are no longer required to beIDeletable
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 adispose
and asetDeleteStyle
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 extendingIDeletable
orIMovable
. If you were relying on callingselectable.isDeletable
on anISelectable
you should change this toBlockly.isDeletable(selectable) && selectable.isDeletable()
. The first call ensures that the block has anisDeletable
method. If you were relying on callingselectable.isMovable
on anISelectable
you should change this toBlockly.isDraggable(selectable) && selectable.isMovable()
. The first call ensures that the block has anisMovable
method.