Skip to content

Merge origin/feat/2.7 into origin/main#166

Merged
yiiqii merged 6 commits into
mainfrom
feat/2.7
Dec 15, 2025
Merged

Merge origin/feat/2.7 into origin/main#166
yiiqii merged 6 commits into
mainfrom
feat/2.7

Conversation

@yiiqii

@yiiqii yiiqii commented Dec 15, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added HEVC video codec support for video assets.
    • Introduced KTX2 compressed image format.
    • Enhanced text layout with vertical alignment options.
    • Added auto-height and sizing controls for rich text content.
    • Added loop control for texture sheet animations.
  • Chores

    • Version bumped to 2.7.0.

✏️ Tip: You can customize this high-level summary in your review settings.

ChengYi996 and others added 6 commits November 10, 2025 15:31
* feat: ktx2 support

* feat: add ktx2 in ImageSource

* feat: remove old compressed format
…h text (#161)

* refactor: refactor text layout

* fix: add ,

---------

Co-authored-by: linxi <guoshiquan.gsq@antgroup.com>
* feat: add sprite loop property

* refactor: move sprite loop to TextureSheetAnimation

* chore: update
* feat: add video info

* feat: change codec to an enum class
@yiiqii
yiiqii requested a review from wumaolinmaoan December 15, 2025 07:57
@coderabbitai

coderabbitai Bot commented Dec 15, 2025

Copy link
Copy Markdown

Walkthrough

Version bumped to 2.7.0. Type definitions updated for video assets (HevcVideoCodec, VideoInfo), text styling (TextVerticalAlign, layout properties restructured), and animation frame loops. API surface changes include compressed image format migration to KTX2, and property redistributions across text and sprite/animation interfaces.

Changes

Cohort / File(s) Summary
Version Update
package.json
Version bumped from 2.6.0 to 2.7.0
Video and Asset Type Definitions
src/assets.ts, src/scene.ts
Added HevcVideoCodec enum and VideoInfo interface for HEVC video support; migrated CompressedImage from compressed object structure to ktx2 string property; updated JSONScene.videos type from AssetBase[] to VideoInfo[]; introduced JSONSceneVersion 3_6
Text Vertical Alignment
src/text.ts, src/item/text-item.ts
Added TextVerticalAlign enum (top, middle, bottom); restructured TextContentOptions by removing lineHeight, sizeMode, maxTextWidth, maxTextHeight; replaced wrapEnabled with autoHeight; added lineHeight and textVerticalAlign to BaseTextContentOptions
Rich Text Item Enhancement
src/item/rich-text-item.ts
Extended RichTextContentOptions with maxTextWidth, maxTextHeight, wrapEnabled, and sizeMode properties for fine-grained text layout control
Animation Loop Restructuring
src/item/sprite-item.ts, src/type.ts
Removed loop property from SpriteComponentData; added loop property to TextureSheetAnimation interface

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~13 minutes

  • src/item/text-item.ts requires extra attention due to the multi-property restructuring across two interfaces (TextContentOptions and BaseTextContentOptions) and import signature changes
  • Verify that TextVerticalAlign enum values and TextSizeMode removal do not break existing implementations in consumers
  • Confirm the animation loop property migration from sprite to texture sheet animation maintains backward compatibility or migration path

Poem

🐰 Hop along with types anew,
Videos dance in HEVC true,
Text aligns with vertical grace,
Loops find their rightful place,
KTX2 textures bright and bold—
Version 2.7, a tale retold!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'Merge origin/feat/2.7 into origin/main' is a generic git merge statement that does not describe the actual changes in the pull request. Replace with a descriptive title summarizing the main changes, such as 'Add HEVC video support, update text layout options, and bump version to 2.7.0' or 'Support video formats and refactor text styling options'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/2.7

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/item/text-item.ts (1)

84-92: Clarify the distinction between textBaseline and textVerticalAlign.

Both properties deal with vertical text positioning but serve different purposes:

  • textBaseline: Controls where text sits relative to the drawing baseline (per-line rendering)
  • textVerticalAlign: Controls how the text block aligns within its container

Consider adding a brief clarifying comment to help consumers understand when to use each property.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2ea68a5 and 989860e.

📒 Files selected for processing (8)
  • package.json (1 hunks)
  • src/assets.ts (3 hunks)
  • src/item/rich-text-item.ts (2 hunks)
  • src/item/sprite-item.ts (0 hunks)
  • src/item/text-item.ts (4 hunks)
  • src/scene.ts (3 hunks)
  • src/text.ts (1 hunks)
  • src/type.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • src/item/sprite-item.ts
🧰 Additional context used
🧬 Code graph analysis (1)
src/scene.ts (1)
src/assets.ts (1)
  • VideoInfo (92-97)
🔇 Additional comments (11)
package.json (1)

3-3: Version bump to 2.7.0 is appropriate for this release.

The version increment aligns with the new features (HEVC video codec support, KTX2 texture format, TextVerticalAlign enum, loop property) and the breaking change to CompressedImage interface.

src/type.ts (1)

219-223: Verify that the required loop property is intentional.

The new loop: boolean field is non-optional, which means all existing TextureSheetAnimation objects must now include this property. This is a breaking change for consumers creating these objects.

If backward compatibility is desired, consider making it optional with a default:

-  loop: boolean,
+  /**
+   * 图层帧动画是否循环播放
+   * @default true
+   */
+  loop?: boolean,
src/scene.ts (2)

38-39: LGTM! Version 3.6 addition follows established conventions.

The new JSON scene version correctly documents the KTX2, H265, and text enhancement capabilities. The LATEST pointer update is appropriate.


175-175: Type narrowing from AssetBase[] to VideoInfo[] is a compatible refinement.

Since VideoInfo extends AssetBase, existing video entries remain valid. The narrower type enables access to the new optional hevc property for HEVC video support.

src/text.ts (1)

123-136: LGTM! The new TextVerticalAlign enum is well-documented.

Note: TextVerticalAlign and TextBaseline share identical values but serve different purposes—TextBaseline controls per-line baseline positioning while TextVerticalAlign controls vertical alignment of the entire text block within its container.

src/assets.ts (3)

40-49: LGTM! HEVC codec levels are correctly defined.

The enum covers standard HEVC Main Profile levels from L30 (SD) through L180 (8K), following the hev1.1.0.Lxx.B0 codec string format used in media capabilities detection.


92-97: LGTM! VideoInfo interface properly extends AssetBase.

The optional hevc property enables HEVC video support while maintaining backward compatibility with existing video assets. The url accepting both string and HTMLVideoElement provides flexibility for different runtime scenarios.


109-113: Breaking change: CompressedImage structure simplified to KTX2-only.

The previous compressed: { astc?, pvrtc? } structure has been replaced with a simple ktx2?: string. This is a breaking change for any code relying on the old structure.

Ensure consumers are aware that:

  1. ASTC/PVRTC-specific paths are no longer supported at the type level
  2. KTX2 container format is now the expected compressed texture format
src/item/rich-text-item.ts (1)

30-48: LGTM! Layout properties for rich text are well-designed.

The new optional properties (maxTextWidth, maxTextHeight, wrapEnabled, sizeMode) enable flexible text layout control with sensible defaults. All properties are optional, maintaining backward compatibility.

src/item/text-item.ts (2)

42-45: LGTM! The autoHeight property complements autoWidth.

The addition provides symmetric control over adaptive text sizing. The comment correctly notes the conflict with fixed height settings.


59-63: LGTM! lineHeight property enables fine-grained text layout control.

The default value of 31 provides a reasonable starting point for text rendering.

@yiiqii
yiiqii merged commit b3c4232 into main Dec 15, 2025
3 checks passed
@yiiqii
yiiqii deleted the feat/2.7 branch December 15, 2025 08:11
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.

4 participants