rive-wasm icon indicating copy to clipboard operation
rive-wasm copied to clipboard

refactor(layout): add Layout class and enums for canvas fit and align…

Open samavati opened this issue 1 year ago • 1 comments

Layout module refactor

Description

This pull request refactors the existing Layout class and related enums for managing the fit and alignment of Rive animations within an HTML canvas. The refactoring aims to improve code organization, maintainability, and adherence to best practices.

Changes

  • Move the Layout class to a dedicated file js/src/layout/Layout.ts
  • Move the Fit and Alignment enums to separate files within js/src/layout/enums/
  • Create a types directory within js/src/layout/ to house the LayoutParameters interface
  • Update import statements across the codebase to reflect the new file structure
  • Export the Layout class and enums from js/src/layout/index.ts
  • Update js/src/rive.ts to export the Layout class and enums

Benefits

  • Improved code organization and separation of concerns
  • Better adherence to the principle of single responsibility
  • Easier maintenance and extensibility of the Layout class and related types
  • Consistent import paths for the Layout class and enums across the codebase

Documentation

  • Existing documentation for the Layout class and enums has been updated to reflect the new file structure and import paths

Risks

No significant risks have been identified.

samavati avatar Jun 24 '24 18:06 samavati