| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Declare it on classes that must implement it. This prevents to implement wrong method signature or to miss a method.
WalkthroughThis update standardizes the implementation of mouse event handler interfaces across multiple classes in the codebase. Several classes now explicitly implement the MouseListenerSet interface, and the method signatures for mouse event handlers (mouseDown, mouseMove, mouseUp) have been updated to clarify parameter usage. Unused parameters are renamed or removed, and type annotations are refined for consistency. Additionally, minor documentation and comment improvements were made, and some import statements were adjusted to use type-only imports. There are no changes to the internal logic, control flow, or exported entity behavior beyond interface and signature clarifications. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Graph
participant MouseListenerSet (Handler)
User->>Graph: Triggers mouse event (down/move/up)
Graph->>MouseListenerSet: Calls mouseDown/_Move/_Up(_sender, event)
MouseListenerSet-->>Graph: Handles event (parameter _sender may be unused)
Graph-->>User: Event processed
This diagram represents the standardized flow of mouse events from the user through the graph to the handlers implementing the MouseListenerSet interface, reflecting the updated method signatures and interface implementations. Suggested labelsjavascript Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
📜 Recent review details Configuration used: CodeRabbit UI Reviewing files that changed from the base of the PR and between 8e8775a and f31dbbd. 📒 Files selected for processing (1)
🪧 Tips ChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (.coderabbit.yaml)
Documentation and Community
|
Sorry, something went wrong.
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review detailsConfiguration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Reviewing files that changed from the base of the PR and between 7cac321 and 35e386f.
📒 Files selected for processing (12)packages/core/src/types.ts (2)packages/core/src/view/handler/EdgeHandler.ts (1)
- GraphPlugin (1109-1111)
- MouseListenerSet (1135-1139)
packages/core/src/types.ts (1)packages/core/src/view/plugins/RubberBandHandler.ts (1)
- MouseListenerSet (1135-1139)
packages/core/src/types.ts (2)packages/core/src/view/cell/CellTracker.ts (1)
- GraphPlugin (1109-1111)
- MouseListenerSet (1135-1139)
packages/core/src/types.ts (1)packages/core/src/view/other/Outline.ts (1)
- MouseListenerSet (1135-1139)
packages/core/src/types.ts (1)packages/core/src/view/handler/VertexHandler.ts (1)
- MouseListenerSet (1135-1139)
packages/core/src/types.ts (1)packages/core/src/view/plugins/ConnectionHandler.ts (1)
- MouseListenerSet (1135-1139)
packages/core/src/types.ts (2)packages/core/src/view/plugins/TooltipHandler.ts (1)
- GraphPlugin (1109-1111)
- MouseListenerSet (1135-1139)
packages/core/src/types.ts (2)⏰ Context from checks skipped due to timeout of 90000ms (2)
- GraphPlugin (1109-1111)
- MouseListenerSet (1135-1139)
packages/core/src/view/plugins/SelectionCellsHandler.ts (2)27-27: Good addition of type-safe interface import.
The explicit type import of MouseListenerSet prepares for the interface implementation, improving code organization and type safety.
51-51: Excellent enhancement to class declaration.
Explicitly implementing the MouseListenerSet interface alongside GraphPlugin provides stronger type checking and better documents the class's capabilities. This ensures the class correctly implements all required mouse handler methods with proper signatures, preventing potential runtime errors.
packages/core/src/view/other/PanningManager.ts (1)44-56: Clean and effective parameter simplification.
Removing unused parameters from the mouse event handlers improves code clarity while maintaining interface compatibility. This change makes it immediately clear that these methods don't use any event information. The implementation remains unchanged functionally but is now more maintainable and easier to understand.
packages/core/src/view/GraphView.ts (1)2173-2177: Simplified method signature improves clarity.
Removing unused parameters from the mouseDown handler creates cleaner, more maintainable code by making it immediately obvious the method doesn't use any event parameters. This refactoring maintains interface compatibility while improving code readability.
packages/core/src/editor/Editor.ts (1)1628-1628: Improved type safety and parameter naming convention.
Changing the parameter type from any to EventSource and renaming from sender to _sender follows best practices for TypeScript interfaces. The underscore prefix clearly indicates the parameter is intentionally unused, while the explicit type ensures compatibility with the MouseListenerSet interface and helps catch potential type errors.
Also applies to: 1643-1643, 1649-1649
packages/core/src/view/other/DragSource.ts (4)55-57: Documentation improvements look good.
The class documentation has been reformatted for better readability while maintaining the original content.
126-127: Updated reference from mxGraph to Graph in documentation.
The comment has been updated to use the current class name Graph instead of legacy mxGraph, which improves consistency.
141-142: Updated references from mxGuide to Guide in comments.
The comments have been updated to reference the current class name Guide instead of legacy mxGuide, maintaining consistency with the codebase.
Also applies to: 146-147
294-299: Documentation example code has been modernized.
The code example in the comment has been improved:
- Changed variable declaration from var to const
- Updated event utility references from mxEvent to EventUtils
This aligns with modern JavaScript practices and current naming in the codebase.
packages/core/src/view/plugins/ConnectionHandler.ts (3)60-66: Updated imports to include MouseListenerSet as a type import.
The import statement now correctly includes the MouseListenerSet type, which is necessary for the interface implementation.
207-207: Explicitly implementing MouseListenerSet interface.
The ConnectionHandler class now explicitly implements the MouseListenerSet interface alongside GraphPlugin. This guarantees that the class implements all required mouse event handler methods with the correct signatures, improving type safety.
754-754: Updated mouse event handler parameters to indicate unused parameters.
The first parameter in mouse event handlers has been renamed from sender to _sender to clearly indicate that it's unused within these methods. This follows TypeScript conventions for marking unused parameters.
Also applies to: 1026-1026, 1491-1491
packages/core/src/view/plugins/TooltipHandler.ts (3)28-28: Added MouseListenerSet to import statement.
The import statement now properly includes the MouseListenerSet type, which is necessary for the interface implementation.
40-40: TooltipHandler now explicitly implements MouseListenerSet interface.
Explicitly implementing the MouseListenerSet interface ensures that the class implements all required mouse event handler methods with the correct signatures, improving type safety and preventing potential errors.
177-178: Updated mouse event handler parameters and documentation.
The parameter naming has been updated from sender to _sender to indicate it's unused in the method implementations, and some comment text has been improved. This follows TypeScript conventions for marking unused parameters.
Also applies to: 185-185, 210-210
packages/core/src/view/handler/EdgeHandler.ts (3)59-59: Updated imports to include MouseListenerSet.
The import statement now properly includes the MouseListenerSet type, which is necessary for the interface implementation.
77-77: EdgeHandler now explicitly implements MouseListenerSet.
The class now explicitly implements the MouseListenerSet interface, ensuring that it provides all required mouse event handler methods with the correct signatures. This improves type safety and enforces the interface contract.
787-787: Updated mouse event handler parameters to indicate unused parameters.
The first parameter in mouse event handlers has been renamed from sender to _sender to clearly indicate that it's unused within these methods. This is a good practice in TypeScript to mark parameters that are part of an interface but not used in the implementation.
Also applies to: 1311-1311, 1419-1419
packages/core/src/view/cell/CellTracker.ts (3)24-24: Looks good: Import of MouseListenerSet as type.
The import has been correctly updated to import MouseListenerSet as a type from the types file.
79-79: Good: Explicit implementation of MouseListenerSet interface.
Explicitly implementing the MouseListenerSet interface helps ensure type safety and enforces the correct method signatures.
106-106: Good: Renamed unused parameter to indicate it's not used.
Renaming the sender parameter to _sender clearly indicates that this parameter is not used in the method implementation, which is a good practice.
packages/core/src/view/handler/VertexHandler.ts (5)33-34: Looks good: Import of MouseListenerSet as type.
The import has been correctly updated to import MouseListenerSet as a type from the types file.
49-49: Good: Explicit implementation of MouseListenerSet interface.
Explicitly implementing the MouseListenerSet interface helps ensure type safety and enforces the correct method signatures.
635-635: Good: Renamed unused parameter to indicate it's not used.
Renaming the sender parameter to _sender clearly indicates that this parameter is not used in the method implementation, which is a good practice.
834-834: Good: Renamed unused parameter to indicate it's not used.
Renaming the sender parameter to _sender clearly indicates that this parameter is not used in the method implementation, which is a good practice.
1210-1210: Good: Renamed unused parameter to indicate it's not used.
Renaming the sender parameter to _sender clearly indicates that this parameter is not used in the method implementation, which is a good practice.
packages/core/src/view/plugins/RubberBandHandler.ts (5)34-35: Looks good: Import of MouseListenerSet and GraphPlugin as types.
The imports have been correctly updated to import both MouseListenerSet and GraphPlugin as types from the types file.
60-60: Good: Explicit implementation of MouseListenerSet and GraphPlugin interfaces.
Explicitly implementing both the MouseListenerSet and GraphPlugin interfaces helps ensure type safety and enforces the correct method signatures.
180-180: Good: Renamed unused parameter to indicate it's not used.
Renaming the sender parameter to _sender clearly indicates that this parameter is not used in the method implementation, which is a good practice.
243-243: Good: Renamed unused parameter to indicate it's not used.
Renaming the sender parameter to _sender clearly indicates that this parameter is not used in the method implementation, which is a good practice.
300-300: Good: Renamed unused parameter to indicate it's not used.
Renaming the sender parameter to _sender clearly indicates that this parameter is not used in the method implementation, which is a good practice.
packages/core/src/view/other/Outline.ts (6)38-38: Looks good: Import of MouseListenerSet as type and updating Listenable import.
The imports have been correctly updated to import MouseListenerSet as a type and change Listenable to a type import as well.
81-81: Good: Explicit implementation of MouseListenerSet interface.
Explicitly implementing the MouseListenerSet interface helps ensure type safety and enforces the correct method signatures.
82-87: Clean constructor parameter simplification.
Changed the constructor parameter container to be optional without a default value, which is cleaner and makes the optional nature of the parameter more explicit in the signature.
575-575: Good: Renamed unused parameter to indicate it's not used.
Renaming the sender parameter to _sender clearly indicates that this parameter is not used in the method implementation, which is a good practice.
607-607: Good: Renamed unused parameter to indicate it's not used.
Renaming the sender parameter to _sender clearly indicates that this parameter is not used in the method implementation, which is a good practice.
702-702: Good: Renamed unused parameter to indicate it's not used.
Renaming the sender parameter to _sender clearly indicates that this parameter is not used in the method implementation, which is a good practice.
Sorry, something went wrong.
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Declare it on classes that must implement it.
This avoids implementing the wrong method signature or omitting a method.
Summary by CodeRabbit