Skip to content

Commit

Permalink
[Canvas] Repeat image bug with image height fixed. (#121497)
Browse files Browse the repository at this point in the history
* Fixed typo and increased performance.

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
Kuznietsov and kibanamachine authored Dec 22, 2021
1 parent e69b1d9 commit 5dc03d0
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function createImageJSX(img: HTMLImageElement | null) {
if (!img) {
return null;
}
const params = img.width > img.height ? { heigth: img.height } : { width: img.width };
const params = img.width > img.height ? { height: img.height } : { width: img.width };
return <img src={img.src} {...params} alt="" />;
}

Expand Down Expand Up @@ -82,12 +82,14 @@ function RepeatImageComponent({

if (image) {
setImageSize(image, size);
times(count, () => imagesToRender.push(createImageJSX(image)));
const imgJSX = createImageJSX(image);
times(count, () => imagesToRender.push(imgJSX));
}

if (emptyImage) {
setImageSize(emptyImage, size);
times(max - count, () => imagesToRender.push(createImageJSX(emptyImage)));
const imgJSX = createImageJSX(emptyImage);
times(max - count, () => imagesToRender.push(imgJSX));
}

return (
Expand Down

0 comments on commit 5dc03d0

Please sign in to comment.