I want to change the attributes on an svg element in an html page.
svgElement.setAttribute("width", `${width_}`); //instruction 1
svgElement.setAttribute("height", `${height_}`); //instruction 2
svgElement.setAttribute("viewBox",`${x} ${y} ${width_} ${height_}`); // instruction 3
width_ and height_ are new values, different from the pre existing attribute values.
"instruction 1"
causes a horizontal zoom.
"instruction 2"
causes a vertical zoom.
"instruction 3"
zooms everything back to how it was before, as if there had been no zooming at all.
Is it possible to avoid this effect ?
I was looking into the possibility of setting multiple attributes in one single transaction, but it does not seem possible (correct me if I am wrong).