Skip to content

refactor: import engine constants instead of duplicating them#1891

Merged
willeastcott merged 1 commit intomainfrom
refactor/import-engine-constants
Mar 5, 2026
Merged

refactor: import engine constants instead of duplicating them#1891
willeastcott merged 1 commit intomainfrom
refactor/import-engine-constants

Conversation

@willeastcott
Copy link
Contributor

@willeastcott willeastcott commented Mar 5, 2026

Summary

  • Remove 13 duplicated constant definitions from src/core/constants.ts that are already exported by the PlayCanvas engine (ORIENTATION_*, FITTING_*, BUTTON_TRANSITION_MODE_*, SCROLL_MODE_*, SCROLLBAR_VISIBILITY_*)
  • Update 7 consumer files to import these constants from playcanvas instead of @/core/constants
  • Remove dead code: CURVE_CATMULL and CURVE_CARDINAL (unused anywhere in the editor)

Test plan

  • Verify the editor builds without errors
  • Verify the layout group, button, scrollbar, and scroll view component inspectors render correctly

@vercel
Copy link

vercel bot commented Mar 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
editor Ready Ready Preview, Comment Mar 5, 2026 1:01pm

Request Review

Remove duplicated constant definitions from the editor and import them
from the playcanvas engine package instead. Also remove dead code
(CURVE_CATMULL, CURVE_CARDINAL) that was unused.

Made-with: Cursor
Copy link
Contributor

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

Refactors the editor codebase to rely on PlayCanvas engine exports for several UI-related constants, removing duplicated definitions from the editor’s core constants module.

Changes:

  • Removed duplicated PlayCanvas UI constants (orientation, fitting, button transition modes, scroll view modes/visibility) from src/core/constants.ts.
  • Updated affected editor/inspector consumers to import these constants directly from playcanvas.
  • Removed unused editor-specific curve constants (CURVE_CATMULL, CURVE_CARDINAL).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/editor/viewport/viewport-entities-elements.ts Switches orientation constants import to playcanvas.
src/editor/inspector/components/scrollview.ts Switches scroll mode/visibility constants import to playcanvas.
src/editor/inspector/components/scrollbar.ts Switches orientation constants import to playcanvas.
src/editor/inspector/components/layoutgroup.ts Switches orientation/fitting constants import to playcanvas.
src/editor/inspector/components/button.ts Switches button transition mode constants import to playcanvas.
src/editor/entities/entities-menu.ts Switches orientation constants import to playcanvas while keeping editor-specific constants from core.
src/editor/components/scrollbar/components-scrollbar-defaults.ts Switches orientation constants import to playcanvas.
src/core/constants.ts Removes duplicated engine constants and deletes unused curve constants.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@willeastcott willeastcott merged commit e66a6a4 into main Mar 5, 2026
7 checks passed
@willeastcott willeastcott deleted the refactor/import-engine-constants branch March 5, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants