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

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

Thanks in advance

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

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

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

1 Like