Description
What problem does this solve or what need does it fill?
Having images in UI that you want to be displayed exactly without any scaling. No resizing allowed.
For example, I want to create a toolbar button with an icon in it. The image assets for the button's background and the icons are intended to be fixed size and displayed as is, exactly that size.
What solution would you like?
Currently we have an ImageMode
enum component, which seems to have been created for this exact purpose (controlling the behavior of image scaling). It only has one variant: KeepAspect
. It seems like the sensible/appropriate place for this new addition. We could add a new variant: Exact
, that preserves image dimensions exactly / allows no resizing.
While we are at it, we could also add a ImageMode::Stretch
that allows arbitrary resizing without regard for aspect ratio. Then, the ImageMode
feature set would feel "complete" and cover the most common use cases.
What alternative(s) have you considered?
I could use the Style properties to force the node to have exactly the size of the image, but this is boilerplatey and error-prone. It would be nice if the layout system could take care of it automatically.
Activity