5.18.20
xiaoiver
released this
16 Nov 03:26
·
63 commits
to next
since this release
Patch Changes
- 4fdee19: Keep aspect ratio in image.
When keepAspectRatio
enabled, either width
or height
can be omitted and the missing one can be inferred according to raw image's aspect. In the following example, height
will be calculated automatically after the Image being loaded.
new Image({
style: {
src: 'http://',
keepAspectRatio: true,
width: 100
}
})
But since the image loading process is in an async way, if we try to get bounds immediately, we'll get an empty bounds:
const image = new Image({
style: {
src: 'http://',
keepAspectRatio: true,
width: 100
}
});
image.getBounds(); // empty