-
-
Notifications
You must be signed in to change notification settings - Fork 760
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
Improve drag previews #152
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Thanks @fredjens for this PR, I really like this one!
I'm just not too sure about adding
previewImage
directly into the internal API of the event handlers. However, this is the fault of the current state of the internal handlers, which definitely requires some refactoring.My original idea for the API of the connectors was as such:
Where
opts
could be an object that we can pass to the connector. But it just so happens that almost every connectors'opts
happened to just be a single value which isnodeId
most of the time (ie:connectors.drag(dom, nodeId)
.Anyways, I'm thinking we could do either one of the following to fix this situation:
Solution 1: Add a 3rd parameter for additional options
In this case, we basically turn the 2nd parameter to contain the required value by the connector (ie: the
nodeId
) and we add a 3rd parameter for additional optionsSolution 2: Create an alias for the 2nd parameter
In this case, the connectors' 2nd parameter can either be the single required value (ie:
nodeId
) or an object to specify required value and additional options.Personally, I prefer the first solution because it's probably easier to achieve; and the only benefit of the 2nd solution is that we keep parameter count to just 2, but at the expense of added complexity. What do you think?
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 prefer solution 1, too.
I don't think the added complexity is worth it. And I would argue, that from an API consumer's perspective (esp. beginners)
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.
Hi there! Thanks for the feedback! Really sorry, but I do not think I have time to finish this in the nearest future... So if anyone else want to finish this, feel free!