I realize there are ways through the API to do the following:
- Set the
viewport
- Set the position of the plugin UI within the viewport
But is there a way to get the current position of the plugin UI once it is open?
I realize there are ways through the API to do the following:
viewport
But is there a way to get the current position of the plugin UI once it is open?
There is a way to get the UI position – but its more a work around.
This are the steps I did to get the UI position (more or less accurate):
I was able to calculate the position of the UI and place an element next to the UI.
I’m surprised there’s nothing in figma.viewport to facilitate this.
P.S.: I am trying your method and I notice that I have to first click in the canvas, then click in the window, for the user position to be updated, and I’m wondering if there’s a way to automate this, maybe to forward the pointer event to the canvas?
window.blur();
window.focus();
doesn’t work. 🤣
P.P.S.: Oh, so the currentUser position is the last position on the canvas, so I need to simulate a canvas click somehow, like if creating and deleting an object set the last mouse user coordinates to the top-left corner of that object, or something like that. Any clue?
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.