Closed avivfaraj closed 1 year ago
Hey @avivfaraj Thanks for the PR. I'll be reviewing the changes soon and will get back to you. Sorry for the delay.
Hey @avivfaraj , I found that you changed the checks from Name to Type. Sadly this won't work. Because Figma API doesn't return the element type as we want. It doesn't know which element is what. It just knows that this is a Rectangle or This is a Square. That's why we need naming convention for the conversion.
Can we only include the Stroke & Ellipse feature from this PR ? I already merged a Line feature PR.
Hey @avivfaraj , I found that you changed the checks from Name to Type. Sadly this won't work. Because Figma API doesn't return the element type as we want. It doesn't know which element is what. It just knows that this is a Rectangle or This is a Square. That's why we need naming convention for the conversion.
I am not sure I understand what your are saying. Checking the name doesn't make sense, since you can name each element differently, for instance, "rectangle 360 RC". In this case, your if statement will always fail, which results in a black rectangle because the algorithm didn't find that shape. On the other hand, each element in the API response has a "type" field that indicate which element it is, so it is much better to use it for defining your elements. Attached an image to clarify my point.
As you can see in the image, the name is marked in a white rectangle, and type in red rectangles. Using your name method, the conversion will always fail because the name is not exactly "RECTANGLE" or "LINE" or "ELLIPSE" because it can be anything I want to (it is a name), whereas type is consistent. There are other type field out there in the document, but you can ignore them, recall that it is json which mean nested dictionaries.
Can we only include the Stroke & Ellipse feature from this PR ? I already merged a Line feature PR.
Yeah
Fixed some bugs: 1) All shapes appear in black - Changed the if statements in frame.py from element_name to element_type. Also, modified color method in vector_elements.py to take into account strokes (outline color) 2) "Rectangle cannot be parse" - Change if statement from "Rectangle" to "VECTOR".
Additions: 1) Line shape - added Line + fixed its color + width 2) Ellipse - Added code for Ellipse + fixed color + outline color