Conversation
* 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
chore: update version
WalkthroughVersion 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~13 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/item/text-item.ts (1)
84-92: Clarify the distinction betweentextBaselineandtextVerticalAlign.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 containerConsider 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
📒 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,
TextVerticalAlignenum,loopproperty) and the breaking change toCompressedImageinterface.src/type.ts (1)
219-223: Verify that the requiredloopproperty is intentional.The new
loop: booleanfield is non-optional, which means all existingTextureSheetAnimationobjects 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
LATESTpointer update is appropriate.
175-175: Type narrowing fromAssetBase[]toVideoInfo[]is a compatible refinement.Since
VideoInfoextendsAssetBase, existing video entries remain valid. The narrower type enables access to the new optionalhevcproperty for HEVC video support.src/text.ts (1)
123-136: LGTM! The newTextVerticalAlignenum is well-documented.Note:
TextVerticalAlignandTextBaselineshare identical values but serve different purposes—TextBaselinecontrols per-line baseline positioning whileTextVerticalAligncontrols 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.B0codec string format used in media capabilities detection.
92-97: LGTM!VideoInfointerface properly extendsAssetBase.The optional
hevcproperty enables HEVC video support while maintaining backward compatibility with existing video assets. Theurlaccepting bothstringandHTMLVideoElementprovides flexibility for different runtime scenarios.
109-113: Breaking change:CompressedImagestructure simplified to KTX2-only.The previous
compressed: { astc?, pvrtc? }structure has been replaced with a simplektx2?: string. This is a breaking change for any code relying on the old structure.Ensure consumers are aware that:
- ASTC/PVRTC-specific paths are no longer supported at the type level
- 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! TheautoHeightproperty complementsautoWidth.The addition provides symmetric control over adaptive text sizing. The comment correctly notes the conflict with fixed height settings.
59-63: LGTM!lineHeightproperty enables fine-grained text layout control.The default value of 31 provides a reasonable starting point for text rendering.
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.