Figma.ui.reposition broken after Window was moved by the User once

figma.ui.reposition only works until user moves the window for the first time.


During development of Parrot we found the need to support different Window Modes like Fullscreen, Docked to the Bottom or modal window - as requested by others - see links below.

To mimic such a behaviour one basically needs to know the windows current position and one needs to be able to change it.

While Figma doesn’t provide a method to get the current possition it supports the repositioning: via figma.ui.reposition.

This function works until the user has moved the window manually by dragging it. After the first drag after showing the window - the function does set the corresponding values but doesn’t move the window.

If found a way to tackle this by calling figma.ui.hide followed by but this can lead to an ugly flickering and intercepts certain mouse events that make things like transitions impossible.

Fixing the bug and providing a way to get the current windows x/y postion would make things a lot easier.

Steps to reproduce

  1. Open a plugin.
  2. Call figma.ui.reposition(10, 10)
  3. See window moving
  4. Call figma.ui.reposition(10, 100)
  5. See window moving
  6. Manually move the window to a different postion
  7. Call figma.ui.reposition(10, 10)
  8. Window does not move
  9. Call figma.ui.hide()
  10. Call
  11. Call figma.ui.reposition(10, 100)
  12. See window moving again

Why is this so important
A lot of tricky little work arounds where needed to make this work - I guess this draws a picture - why fixing this would be great:


+1, We are facing the same problem during plugin development.

By the way @parrot, I wonder how did you manage to get the size of the editor, (as the 2nd video shows, there is a maximize plugin window button) :saluting_face:

+1, We are facing the same issue here.

@Charles_Yin We are using (Figma.viewport.zoom * Figma.viewport.bounds.height) and (Figma.viewport.zoom * Figma.viewport.bounds.width) to get de visible area and maximize our plugin.

Thank you! I’ll try to use this one.

@Charles_Yin sorry for the late reply. The approach described by @Rootedy_Batista is what parrot uses as well.

Any thoughts on this from the Figma team @Josh