daybrush / moveable

Moveable! Draggable! Resizable! Scalable! Rotatable! Warpable! Pinchable! Groupable! Snappable!
https://daybrush.com/moveable/
MIT License
10.08k stars 618 forks source link

Moveable + InfiniteViewer #1055

Open ronny-lark opened 11 months ago

ronny-lark commented 11 months ago

Hello there! I'm trying to make a feature with Moveable and InfiniteViewer to allow drawing squares on top of an image. The whole thing should be zoomable. Here's a sandbox

According to all the docs, the setup should be fairly simple. I couldn't find a single coherent example to use the two things together so I did the thing that made the most sense to me...

  1. Click "draw"
  2. click the blue image
  3. The new red square should be draggable + resizable, and zoom in and out with the infinite viewer.

I can't figure out what's not working here. Ideally I would like to recreate the behaviour in the demo on your website, but the source code is very complicated and has way more than I need. Would love to have some insight on this.

daybrush commented 10 months ago

@ronny-lark

requestAnimationFrame(() => { moveableRef.current!.updateSelectors(); }); }; viewport.addEventListener("mousedown", callback); };