Skip to main content
Question

Polygon shape has rotation = 0 but acts as if it was rotated


Vincent_Huss

Hi !

I’m facing a weird behaviour and wonder wether it’s a bug or something that i’m missing.

In the link i’m sharing you can find a triangle which i found in a component library,
the shape has rotation value of 0 (both in the UI and in the Figma API with node.rotation)

but it’s anchor point (the point which defines the position) is the bottom left corner, instead of the top left corner as usual. You can verify that by typing 0,0 in the x,y coordinate and see the position align on the bottom left corner.

I’m not the author of this triangle, so I don’t know how it was made, but it seems that its Y scale was reversed (allowing to turn a classic triangle to an upside down triangle)

(edit : indeed, if i create a shape and reverse the scale, it behaves the same way)

This would also explain why the y coordinate is inverted and why the x isn’t.

But i can’t find any scaleX / scaleY properties,
and i can’t properly deal with this situation without that information.

I would either need :

  • the coordinate offset to stay on the top left after that kind of rescale operation
  • the scale (x,y) properties to be exposed in the API, so i can transform my coordinates accordingly

Here is the file

Figma – 17 Jun 24

Thanks in advance

4 replies

tank666
  • 4858 replies
  • June 17, 2024

Your object is flipped vertically using the appropriate function, so the coordinates do not correspond to the top left corner.

Figma Learn - Help Center

Vincent_Huss
  • Author
  • Active Member
  • 29 replies
  • June 17, 2024

Thanks,
And the way to find out about it from the plugin API is to look at node.relativeTransform ?


tank666
  • 4858 replies
  • June 18, 2024

Vincent_Huss
  • Author
  • Active Member
  • 29 replies
  • June 19, 2024

Thanks,
for anyone interested :
relativeTransform[0][0] can be either 1 or -1 and tells you if the element has been flipped horizontally
relativeTransform[1][1] can be either 1 or -1 and tells you if the element has been flipped vertically


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