Untitled

mail@pastecode.io avatar
unknown
typescript
7 months ago
368 B
3
Indexable
Never
      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);