I found I have to use img-use to load image to a layer in konva. It work for jpg and png, but not for svg. What else I can do to have one layer with an SVG?
import useImage from "use-image";
const [backgroundImage] = useImage(
`https://ticket-t01.s3.eu-central-1.amazonaws.com/madach-2.svg` || ""
);
Actually it loads the image bit it is very pixelated. Shall I save diffrently the SVG when re-exporting from Illustrator?
<Stage
width={
gridWidth ? (gridWidth >= 600 ? gridWidth : gridWidth) : 200
}
height={
layout && gridWidth
? Math.round(gridWidth / layout.aspectRatio)
: 200
}
>
<Layer>
<Rect
x={0}
y={0}
width={gridWidth || 200}
height={
layout && gridWidth
? Math.round(gridWidth / layout.aspectRatio)
: 200
}
fillPatternImage={backgroundImage}
fillPatternRepeat="no-repeat"
fillPatternScale={{
x: (gridWidth || 200) / (backgroundImage?.width || 200),
y:
(layout && gridWidth
? Math.round(gridWidth / layout.aspectRatio)
: 200) / (backgroundImage?.height || 200),
}}
/>
</Layer>