Need Help with Real-Time Object-to-Line Attachment in Figma Plugin

Hello Figma community,

I’m currently working on a Figma plugin (like auto flow, draw,…)where I aim to create lines that remain attached to objects and dynamically update their positions in real-time as the objects are moved by the user. My goal is to achieve a smooth and interactive experience where the lines seamlessly follow the objects’ movements.

However, I’ve encountered a challenge with Figma’s plugin environment. It seems that there are limitations regarding real-time mouse tracking and continuous event handling, which makes it challenging to implement this feature as desired.

Issue Description:

  • I want to create lines that stay attached to objects.
  • These lines should update their positions in real-time as the objects are moved.
  • Ideally, I’d like to achieve this without manual user intervention (e.g., clicking a button to update the lines).
  • I’ve attempted to use mousemove events to track object movements, but this approach doesn’t work as expected due to Figma’s limitations.

Questions:

  1. Is it currently possible to achieve real-time object-to-line attachment in a Figma plugin?
  2. Are there any best practices or alternative approaches to address this issue?
  3. Have there been any recent updates or features in Figma’s plugin environment that could enable this kind of real-time interactivity?

I would greatly appreciate any insights, guidance, or solutions that the Figma community can provide on this matter. Your expertise and assistance would be invaluable in helping me create a more interactive and user-friendly Figma plugin.

Thank you for your time and assistance!

Best regards, ramin