Conversation
|
Ping @ManevilleF for review here :) |
|
|
||
| fn main() { | ||
| App::new() | ||
| // Change image filter to a pixel-art friendly |
There was a problem hiding this comment.
| // Change image filter to a pixel-art friendly | |
| // Change image filter to a pixel-art friendly mode |
| } | ||
|
|
||
| // Image rect in pixels, inside the base image. | ||
| // Values are using to built a rect with begin (X, Y) and end (X, Y) format |
There was a problem hiding this comment.
Users would really benefit from some more advice on how these values were determined.
| align_items: AlignItems::Center, | ||
| ..default() | ||
| }, | ||
| // Default image has no offset, but that's OK since it'll be update it on button_system |
There was a problem hiding this comment.
| // Default image has no offset, but that's OK since it'll be update it on button_system | |
| // Default image has no offset, but that's OK since it'll be updated in button_system |
|
Code quality and docs seem fine, minus a few nits. I'm not fully sold on the grand vision here, so I'll defer to @mockersf and @ManevilleF who've thought about this space more. |
|
The new property But to customize |
|
I can't do a complete review anytime soon, but anything that impact rendered size should impact layout, and I didn't see layout files being modified in this PR |
|
Closing in favor of #5103; let's collect our efforts there. |
Objective
Currently
UiImagecomponent is just a unit struct forHandle<Image>. At it's core, it draws the image and that's it. If someone needs to have a more complex use case, like implementing a nine patch, one have to useTextureAtlaswhich is good, but is a overkill for ui works.This PR is related to #5070, but it aims to make
TextureAtlasto work withUiImagewhich is a different use case IMO, since one should useTextureAtlasandUiImagetogether on same entity.Solution
Add an
offsetproperty toUiImageand enable to render a portion of the image, much like aTexturaAtlasbut simplified, so users may create it's own image atlas and reuse on manyUiImagecomponents.Changelog
offsetproperty onUiImageand changed to from unit struct to normal struct;DerefandDerefMutfromUiImagesince it's no longer a unit struct;extract_uinodesto useUiImage::offsetwhen it's non-zero;image_buttonexample:Migration Guide
UiImageis now a normal struct so it can't be directly dereferenced anymore and should use normal struct initialization.