Skip to content

feat: enhance BarBounce and BarUtils for better handling of animated …#298

Merged
xile611 merged 2 commits intodevelopfrom
fix/bar-animation
Apr 9, 2026
Merged

feat: enhance BarBounce and BarUtils for better handling of animated …#298
xile611 merged 2 commits intodevelopfrom
fix/bar-animation

Conversation

@xile611
Copy link
Copy Markdown
Contributor

@xile611 xile611 commented Apr 8, 2026

…properties

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Refactoring
  • Update dependency
  • Code style optimization
  • Test Case
  • Branch merge
  • Site / documentation update
  • Demo update
  • Workflow
  • Release
  • Other (about what?)

🔗 Related issue link

🐞 Bugserver case id

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English
🇨🇳 Chinese

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

🚀 Summary

copilot:summary

🔍 Walkthrough

copilot:walkthrough

Copy link
Copy Markdown
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

Updates bar-related custom animations in vstory-animate to better handle normalized bar rect attributes during animation, and adds unit tests to prevent regressions.

Changes:

  • Adjusts createCollapsedBarRect to produce clearer collapsed start rects (explicit width/height handling).
  • Fixes BarBounce orientation handling after rect normalization and computes animated width/height during updates.
  • Adds unit tests covering null-from rects, vertical collapse behavior, and horizontal-mode normalization.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/vstory-animate/src/customAnimates/bar-utils.ts Refines collapsed bar rect generation for vertical/horizontal cases.
packages/vstory-animate/src/customAnimates/bar-bounce.ts Uses a stored vertical/horizontal mode, updates animated width/height, and updates target tags.
packages/vstory-animate/tests/unit/index.test.ts Adds coverage for BarBounce orientation/collapse behavior and update side effects.

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

Comment on lines +72 to +74
Object.assign(this.target.attribute, out);
this.target.addUpdatePositionTag();
this.target.addUpdateShapeAndBoundsTag();
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

onUpdate mutates this.target.attribute directly and then calls addUpdatePositionTag / addUpdateShapeAndBoundsTag. This bypasses the public setAttributes API used elsewhere (including onBind) and introduces a hard dependency on internal target methods that may not exist for all render targets. Prefer this.target.setAttributes(out) (or rely on the base ACustomAnimate update mechanism) so dirty flags/tags are handled consistently.

Suggested change
Object.assign(this.target.attribute, out);
this.target.addUpdatePositionTag();
this.target.addUpdateShapeAndBoundsTag();
this.target.setAttributes(out);

Copilot uses AI. Check for mistakes.
Comment thread packages/vstory-animate/src/customAnimates/bar-utils.ts
@xile611 xile611 merged commit b1db42d into develop Apr 9, 2026
9 of 11 checks passed
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.

3 participants