To zoom an SVG using a transform matrix in JavaScript, you can follow these steps -
index.tsx51 chars2 lines
index.tsx168 chars4 lines
index.tsx48 chars2 lines
Here's the complete implementation for zooming in and out using a mouse wheel event -
index.tsx455 chars16 lines
Note that we are translating the matrix to the mouse position, scaling it, and then translating it back to keep the zoom centered on the mouse position.
gistlibby LogSnag