Skip to content

Feat/enhance background#2064

Merged
xile611 merged 5 commits intodevelopfrom
feat/enhance-background
Apr 1, 2026
Merged

Feat/enhance background#2064
xile611 merged 5 commits intodevelopfrom
feat/enhance-background

Conversation

@xile611
Copy link
Copy Markdown
Contributor

@xile611 xile611 commented Mar 31, 2026

[中文版模板 / 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

This PR enhances VRender’s background image rendering to support more flexible layout behavior (sizing + positioning), and wires those options through stage/group/text/background rendering paths. It also adds a browser demo page and Jest coverage around the new layout behavior.

Changes:

  • Add shared background image layout utilities (backgroundSizing, backgroundPosition) and route multiple renderers through them.
  • Extend public types/defaults to expose BackgroundSizing and BackgroundPosition.
  • Add demo + unit tests validating cover/contain/fill/auto and positioning behavior.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/vrender/tests/browser/src/pages/index.ts Adds a new browser demo entry for background layout.
packages/vrender/tests/browser/src/pages/background.ts New browser demo page showcasing sizing/position/clip across stage/group/text.
packages/vrender-core/src/render/contributions/render/draw-contribution.ts Stage clear-screen path now uses shared background image drawing logic.
packages/vrender-core/src/render/contributions/render/contributions/text-contribution-render.ts Text background rendering now supports sizing/positioning + clip/opacity handling for images.
packages/vrender-core/src/render/contributions/render/contributions/group-contribution-render.ts Group background rendering now forwards sizing/positioning/opacity + unwraps background resource keys.
packages/vrender-core/src/render/contributions/render/contributions/base-contribution-render.ts Introduces drawBackgroundImage, sizing/position resolution, and getBackgroundImage helper.
packages/vrender-core/src/interface/stage.ts Expands stage background typing to accept IGraphicAttribute['background'].
packages/vrender-core/src/interface/render.ts Expands render clear typing to accept IGraphicAttribute['background'].
packages/vrender-core/src/interface/layer.ts Aligns layer background typing with IGraphicAttribute['background'].
packages/vrender-core/src/interface/graphic.ts Adds BackgroundSizing/BackgroundPosition public types + docs.
packages/vrender-core/src/graphic/graphic.ts Unwraps wrapped background.background when loading background images.
packages/vrender-core/src/graphic/config.ts Adds defaults for backgroundSizing and backgroundPosition.
packages/vrender-core/src/core/stage.ts Stage background typing updated; background image loading behavior adjusted.
packages/vrender-core/src/core/layer.ts Fixes layer background declaration type.
packages/vrender-core/tests/background/background-image-layout.test.ts Adds unit tests for sizing/position behavior + renderer parameter forwarding.
common/changes/@visactor/vrender/feat-enhance-background_2026-03-31-08-53.json Changeset entry.
common/changes/@visactor/vrender-core/feat-enhance-background_2026-03-31-08-53.json Changeset entry.

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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

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


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

@xile611 xile611 merged commit 4e7260a into develop Apr 1, 2026
9 of 12 checks passed
@xile611 xile611 deleted the feat/enhance-background branch April 1, 2026 02:59
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