Skip to content

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

willeastcott
Copy link
Contributor

Fixes #7589

I confirm I have read the contributing guidelines and signed the Contributor License Agreement.

Copy link
Contributor

@Copilot Copilot AI left a 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;

@Maksims
Copy link
Collaborator

Maksims commented Apr 29, 2025

Please read: #7589 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC: Migrate API constants to enum-like API
3 participants