I have a React application in which I render multiple polygons on SVG element that is the same size as his parent div which has a background-image property. On desktop it looks like this:
So those green buildings are just polygons mounted on svg. On desktop version everything works fine but when I switch to mobile those polygon coordinates are not in the same place because they are saved as desktop version of width and height. This is html part:
<div className={classes.complexDisplayDiv} style={{ backgroundImage: `url(${photo})` }}>
<svg
height={643}
width={1133}
className={classes.svg}
>
{
buildings.map((building, index) => {
return (
<polygon
points={getPolygonString(building.polygon)}
style={{ fill: 'rgba(129,215,66,0.3)', strokeWidth: '1', }}
/>
)
})
}
</svg>
</div>
And this is css part ( I am using Material UI):
complexDisplayDiv: {
backgroundRepeat: 'no-repeat',
backgroundSize: 'cover',
backgroundPosition: 'center center',
height: '643px',
width: '1133px',
overflow: 'hidden'
}
complexDisplayDiv refers to div element
I've tried setting div on mobile to be width: "100%" but all I get is this: