Render thumbnails at correct aspect ratio
This commit is contained in:
@@ -7,10 +7,11 @@ component ImagePreview inherits Rectangle {
|
||||
in property <length> size: 32px;
|
||||
width: size;
|
||||
height: size;
|
||||
clip: true;
|
||||
|
||||
Image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
width: preview.ratio < 1.0 ? size : size * preview.ratio;
|
||||
height: preview.ratio > 1.0 ? size : size / preview.ratio;
|
||||
source: preview.image;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,13 @@ export enum PreviewKind {
|
||||
|
||||
export struct ImagePreview {
|
||||
asset_id: string,
|
||||
|
||||
// Thumbnail/thumbhash/etc
|
||||
image: image,
|
||||
|
||||
// Image aspect ratio. (width/height)
|
||||
ratio: float,
|
||||
|
||||
kind: PreviewKind,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user