Skip to main content
Question

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


parrot
  • New Participant
  • 18 replies

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

  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 figma.ui.show()
  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:

10 replies

Charles_Yin

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


Charles_Yin

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) 🫡


+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.


Charles_Yin

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


parrot
  • Author
  • New Participant
  • 18 replies
  • November 4, 2023

@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


sojo
  • 1 reply
  • September 18, 2024

I’m concerned that this bug has remained unresolved for a year. It might be worth reconsidering development priorities and focusing on fixing existing issues before implementing large-scale interface changes, such as the UI3 update. While the interface redesign is important, it could potentially lead to new complications if existing problems are not addressed first.


parrot
  • Author
  • New Participant
  • 18 replies
  • January 16, 2025

I solved this for Parrot - kind of - but it involved a lot of creativity. Looking at the code a year later - its not the easiest part to understand... any chance to get this solved and reduce complexety?  ​@Josh ?


You can see the model in action here: 
https://www.loom.com/share/6c73b515fceb471e90bd83bc8f2ca524?t=212


ksn
Figmate
  • Community Support
  • 1624 replies
  • January 16, 2025

@parrot stepping in - Josh is no longer with us at Figma (formally, at least), but he may still pop up to help :D 

 

re: complexity -- I’ll ask our community team for thoughts and reply again here when I hear more.


ksn
Figmate
  • Community Support
  • 1624 replies
  • January 16, 2025

update for you ​@parrot:

I just spoke with our extensibly team, and they’re already working on it. No ETA I can pass on at the moment, though. If I hear anything else, I’ll let you know.


parrot
  • Author
  • New Participant
  • 18 replies
  • January 18, 2025

@ksn great to hear back from u - if the team would like to get more input on the topic - feel free to ping me any time 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings