Skip to content

Refresh NineSlice UVs when setFrame skips resizing - #7368

Open
ICOM725 wants to merge 1 commit into
phaserjs:masterfrom
ICOM725:fix/nineslice-frame-uvs
Open

Refresh NineSlice UVs when setFrame skips resizing#7368
ICOM725 wants to merge 1 commit into
phaserjs:masterfrom
ICOM725:fix/nineslice-frame-uvs

Conversation

@ICOM725

@ICOM725 ICOM725 commented Sep 7, 2026

Copy link
Copy Markdown

This PR

  • Fixes a bug

Describe the changes below:

NineSlice.setFrame(frame, false) changes the frame reference but leaves the vertex UVs unchanged, because they are only refreshed through setSizeToFrame(). Add a NineSlice override that delegates to the existing Texture component and refreshes UVs when resizing is disabled.

ChrisCPI previously included a fix for this in #7167. That PR was closed during the v3 transition with an invitation to resubmit changes still applicable to v4. This PR keeps the change limited to frame updates and adds regression tests against the current v4 source.

The ten tests cover 3-slice and 9-slice objects, both updateOrigin values, Frame instances, the default size-update behavior, and the setTexture(..., false, false) path. They check actual vertex UVs and verify that skipping size/origin updates preserves dimensions and vertex positions.

Fixes #7110.

Verification:

  • Before the fix, eight regression tests failed and the two default-size controls passed.
  • npm test -- tests/gameobjects/nineslice tests/gameobjects/components/Texture.test.js --maxWorkers=2: 6 files and 75 tests passed.
  • Targeted ESLint 8.57.1 checks passed for both changed files using the repository configuration.
  • npm run build: webpack compiled successfully; the subsequent copy-to-examples step reported the missing sibling examples directory.
  • git diff --check 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.

NineSlice setFrame() doesnt work when updateSize is false

1 participant