Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

9-slice sprite is behaving weirdly on ImageBundle #11944

Closed
Litttlefish opened this issue Feb 18, 2024 Discussed in #11937 · 8 comments · Fixed by #12047
Closed

9-slice sprite is behaving weirdly on ImageBundle #11944

Litttlefish opened this issue Feb 18, 2024 Discussed in #11937 · 8 comments · Fixed by #12047
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior
Milestone

Comments

@Litttlefish
Copy link
Contributor

Litttlefish commented Feb 18, 2024

Discussed in #11937

Originally posted by Litttlefish February 18, 2024
I'm using the 9-slice feature on 0.13 to rewrite a counter ui, but when using it, it give me a weird result that is not scaled down.(should be 60px x 30px)
image
If I remove ImageScaleMode component, then it will give me a sprite that is correctly resized.
图片
Also I tried using it with SpriteBundle, seems working normally. (here is 240px x 30px)
图片

@Litttlefish
Copy link
Contributor Author

Further information:
image size is 240*120, while the ui node size should be 30px high and fits text length, BorderRect size is 48 px squared

@JMS55 JMS55 added C-Bug An unexpected or incorrect behavior A-UI Graphical user interfaces, styles, layouts, and widgets labels Feb 18, 2024
@JMS55 JMS55 added this to the 0.13.1 milestone Feb 18, 2024
@Litttlefish
Copy link
Contributor Author

Litttlefish commented Feb 19, 2024

An addendum:
seems ButtonBundle works fine, only ImageBundle and AtlasImageBundle has this problem(source from bevy discord)
image
(lower one is ButtonBundle )

@ManevilleF
Copy link
Contributor

Could you provide some code to reproduce ? I made the slicing feature so I might be able to help and fix it

@Litttlefish
Copy link
Contributor Author

Could you provide some code to reproduce ? I made the slicing feature so I might be able to help and fix it

I think the 9-slicing example can tell by replacing ButtonBundle to ImageBundle or AtlasImageBundle.

image

Because the upper one in this image also has this problem, but the actual button is larger than the image size, so I will also rename the issue.

@Litttlefish Litttlefish changed the title 9-slice sprite is behaving weirdly on UI when sprite size is smaller than texture size 9-slice sprite is behaving weirdly on ImageBundle and AtlasImageBundle Feb 22, 2024
@ManevilleF
Copy link
Contributor

Texture atlas are not supported by slicing yet, but the Image bundle should work, I'll try

@Litttlefish Litttlefish changed the title 9-slice sprite is behaving weirdly on ImageBundle and AtlasImageBundle 9-slice sprite is behaving weirdly on ImageBundle Feb 22, 2024
@ManevilleF
Copy link
Contributor

@Litttlefish Yup it doesn't work with ImageBundle, my bad this is due to a mistake in my implementation, I'll open a PR right away

@ManevilleF
Copy link
Contributor

@Litttlefish Can you try with the fix ?

@Litttlefish
Copy link
Contributor Author

@Litttlefish Can you try with the fix ?

Tried, seems it works normally now.
图片

github-merge-queue bot pushed a commit that referenced this issue Feb 23, 2024
# Objective

Fixes #11944

## Solution

#11600 made an incorrect assumption on what `UiImageSize` does, removing
its usage in slicing fixes the problem
msvbg pushed a commit to msvbg/bevy that referenced this issue Feb 26, 2024
# Objective

Fixes bevyengine#11944

## Solution

bevyengine#11600 made an incorrect assumption on what `UiImageSize` does, removing
its usage in slicing fixes the problem
msvbg pushed a commit to msvbg/bevy that referenced this issue Feb 26, 2024
# Objective

Fixes bevyengine#11944

## Solution

bevyengine#11600 made an incorrect assumption on what `UiImageSize` does, removing
its usage in slicing fixes the problem
mockersf pushed a commit that referenced this issue Feb 27, 2024
# Objective

Fixes #11944

## Solution

#11600 made an incorrect assumption on what `UiImageSize` does, removing
its usage in slicing fixes the problem
github-merge-queue bot pushed a commit that referenced this issue Mar 5, 2024
# Objective

Follow up to #11600 and #10588 
#11944 made clear that some
people want to use slicing with texture atlases

## Changelog

* Added support for `TextureAtlas` slicing and tiling.
`SpriteSheetBundle` and `AtlasImageBundle` can now use `ImageScaleMode`
* Added new `ui_texture_atlas_slice` example using a texture sheet

<img width="798" alt="Screenshot 2024-02-23 at 11 58 35"
src="https:/bevyengine/bevy/assets/26703856/47a8b764-127c-4a06-893f-181703777501">

---------

Co-authored-by: Alice Cecile <[email protected]>
Co-authored-by: Pablo Reinhardt <[email protected]>
spectria-limina pushed a commit to spectria-limina/bevy that referenced this issue Mar 9, 2024
# Objective

Follow up to bevyengine#11600 and bevyengine#10588 
bevyengine#11944 made clear that some
people want to use slicing with texture atlases

## Changelog

* Added support for `TextureAtlas` slicing and tiling.
`SpriteSheetBundle` and `AtlasImageBundle` can now use `ImageScaleMode`
* Added new `ui_texture_atlas_slice` example using a texture sheet

<img width="798" alt="Screenshot 2024-02-23 at 11 58 35"
src="https:/bevyengine/bevy/assets/26703856/47a8b764-127c-4a06-893f-181703777501">

---------

Co-authored-by: Alice Cecile <[email protected]>
Co-authored-by: Pablo Reinhardt <[email protected]>
msvbg pushed a commit to msvbg/bevy that referenced this issue Jun 11, 2024
Follow up to bevyengine#11600 and bevyengine#10588
bevyengine#11944 made clear that some
people want to use slicing with texture atlases

* Added support for `TextureAtlas` slicing and tiling.
`SpriteSheetBundle` and `AtlasImageBundle` can now use `ImageScaleMode`
* Added new `ui_texture_atlas_slice` example using a texture sheet

<img width="798" alt="Screenshot 2024-02-23 at 11 58 35"
src="https:/bevyengine/bevy/assets/26703856/47a8b764-127c-4a06-893f-181703777501">

---------

Co-authored-by: Alice Cecile <[email protected]>
Co-authored-by: Pablo Reinhardt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants