Refresh NineSlice UVs when setFrame skips resizing - #7368
Open
ICOM725 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR
Describe the changes below:
NineSlice.setFrame(frame, false)changes the frame reference but leaves the vertex UVs unchanged, because they are only refreshed throughsetSizeToFrame(). 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
updateOriginvalues, Frame instances, the default size-update behavior, and thesetTexture(..., false, false)path. They check actual vertex UVs and verify that skipping size/origin updates preserves dimensions and vertex positions.Fixes #7110.
Verification:
npm test -- tests/gameobjects/nineslice tests/gameobjects/components/Texture.test.js --maxWorkers=2: 6 files and 75 tests passed.npm run build: webpack compiled successfully; the subsequent copy-to-examples step reported the missing sibling examples directory.git diff --checkpassed.