Skip to main content
Solved

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

  • January 16, 2024
  • 2 replies
  • 364 views

yoshio

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)

Best answer by yoshio

Thanks for the answer.

Thanks to you I have solved the problem.

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

This topic has been closed for replies.

2 replies

figajm
Figmate
  • Figmate
  • January 16, 2024

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
  • Author
  • New Participant
  • Answer
  • January 17, 2024

Thanks for the answer.

Thanks to you I have solved the problem.

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