Untitled
unknown
typescript
2 years ago
368 B
8
Indexable
const wrapperRect = e.currentTarget.getBoundingClientRect();
const x = e.clientX - wrapperRect.left;
const y = e.clientY - wrapperRect.top;
const zoomLevel = 1.5;
const newPanX = (x - wrapperRect.width / 2) * zoomLevel;
const newPanY = (y - wrapperRect.height / 2) * zoomLevel;
setTransform(newPanX * -1, newPanY * -1, 1.5);
Editor is loading...