-
Notifications
You must be signed in to change notification settings - Fork 0
feat: refine SelectionState event model
#148
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
Conversation
Summary of ChangesHello @MinCrohn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a major refinement to the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces a significant and well-designed refinement to the SelectionState event model. By replacing the broad onSelect and onDragSelect callbacks with a more granular set of events like onClick, onDoubleClick, and onDragEnd, it provides developers with much clearer and more intuitive control over user interactions. The implementation in SelectionState.js is solid, and the accompanying test updates correctly validate the new behavior.
My review includes suggestions to improve the documentation examples in README.md and README_KR.md to ensure they are consistent with the new API's best practices, particularly regarding the use of onDragEnd instead of onDrag for final selection and ensuring transformer.elements is always assigned an array. These changes will help users migrate smoothly to the new event model.
Overall, this is an excellent enhancement that greatly improves the usability of the selection state.
|
/gemini review |
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.
Code Review
This pull request introduces a significant and well-thought-out refinement of the SelectionState event model. The move from onSelect and onDragSelect to a more granular set of event callbacks like onClick, onDoubleClick, and onDragEnd is a great improvement for the library's usability and clarity. The implementation is solid, and the accompanying updates to documentation and tests are thorough. I've identified one minor inconsistency in the onUp event handler and provided a suggestion to align its behavior with the rest of the new event model.
The event handling for
SelectionStatehas been refined to be more granular and intuitive.The previous
onSelectandonDragSelectcallbacks made it difficult to clearly distinguish user intents (like single-click, double-click, and drag-select). This update introduces clearer event callbacks likeonClick,onDoubleClick, andonDragEnd, making it easier to implement various interactions.💥 Breaking Changes
onSelectcallback has been removed from theSelectionStateoptions.onDragSelectcallback has been removed from theSelectionStateoptions.✨ New Features (New Event Callbacks)
onDown: Called immediately when the user presses the pointer.onUp: Called on pointer up after a click action (not a drag).onClick: Called when the user clicks a target. (Not called on double-click)onDoubleClick: Called when the user double-clicks a target.onDragStart: Called once when a drag (multi-select) action starts.onDrag: Called repeatedly while a drag action is in progress.onDragEnd: Called when the drag action ends.onOver: Called when the mouse pointer moves over an object.📝 Usage Example (Migration Guide)
Here is an example of how you can migrate your existing logic using the new event callbacks.
Before
After