TL;DR:
figma.ui.reposition
only works until user moves the window for the first time.
Background
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 figma.ui.show
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
- Open a plugin.
- Call
figma.ui.reposition(10, 10)
- See window moving
- Call
figma.ui.reposition(10, 100)
- See window moving
- Manually move the window to a different postion
- Call
figma.ui.reposition(10, 10)
- Window does not move
- Call
figma.ui.hide()
- Call
figma.ui.show()
- Call
figma.ui.reposition(10, 100)
- 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: