-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Convert top-level constants to enums #7630
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR converts the top-level mouse button constants into an enum, updating type annotations and documentation accordingly while removing unused constant exports.
- Updated JSDoc annotations for functions in the mouse API to reference the new MouseButton enum.
- Removed the legacy MOUSEBUTTON_* constants from constants.js and replaced them with enum values in the appropriate modules.
- Adjusted the index and deprecated exports to accommodate the new enum structure.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/platform/input/mouse.js | Updated JSDoc type annotations and added an import comment for MouseButton. |
src/platform/input/mouse-event.js | Changed type annotations and initialized the button property with MouseButton.NONE. |
src/platform/input/controller.js | Revised documentation to reference the new enum (pc.MouseButton.LEFT, etc.). |
src/platform/input/constants.js | Removed legacy mouse constants in favor of the enum. |
src/index.js | Exported the new MouseButton enum for external use. |
src/deprecated/deprecated.js | Updated deprecated constants to reference the new enum values. |
Comments suppressed due to low confidence (1)
src/deprecated/deprecated.js:776
- [nitpick] There is an inconsistency in enum property casing: the new documentation in other parts of the code references pc.MouseButton.LEFT (all uppercase) whereas this export uses MouseButton.Left. Consider standardizing the enum property names to ensure consistency across the codebase.
export const MOUSEBUTTON_LEFT = MouseButton.Left;
Please read: #7589 (comment) |
Fixes #7589
I confirm I have read the contributing guidelines and signed the Contributor License Agreement.