By default, elements inside SVG are scaled by SVG canvases x0 and y0, that is, elements x and y become larger or smaller, resulting in elements not being in the same position before scaling

The solution is to set the coordinates of the elements to x0, y0 before scaling and then scale, and then move to the target x, y after scaling

transform:scale(2)translate(x,y)Copy the code