Skip to main content
yoshio
New Participant
Jan 16, 2024 7:27 AM UTC
Solved

I want to get the same value as the setting value of UI with Plugin API

Integer values were set for X and Y of the layer.
Plugin API X,Y, absoluteTransform to get the values, X is a decimal number.
Is there a way to get the integer value set for a layer?

  • UI Setup Values
    ■Frame (parent node of layer)
    X = -961
    Y = -361
    ■Layer(Layer name=Semicircle)
    X = 1297
    Y = 56
  • Plugin API Values
    X = 1296.999755859375
    Y = 56
    absoluteTransform = [1,-4.493613679069e-17,335.999755859375], [4.493613679069e-17, 1, -305]
    Example_Ellipse.fig (19.3 KB)
This topic has been closed for replies.
yoshio
yoshioSolution
New Participant
Jan 17, 2024 7:53 AM UTC

Thanks for the answer.

Thanks to you I have solved the problem.

I have another problem. If you can help me understand, please answer.

2 replies

figajm
Figmate
Figmate
Jan 16, 2024 4:26 PM UTC

Thanks for asking!

The UI shows x and y values with two decimal points of precision, but as you saw from the Plugin API, the Figma file tracks positioning to a much greater degree of precision. If you’re using and/or changing the position of a node using your plugin, we generally recommend using the position values as-is. But, if you have a need to display the x and y values you retrieved from the plugin API in the same format as the Figma UI, you can round them to two decimal points of precision.

yoshio
yoshioAuthorSolution
New Participant
Jan 17, 2024 7:53 AM UTC

Thanks for the answer.

Thanks to you I have solved the problem.

I have another problem. If you can help me understand, please answer.