(node: SceneNode)
| 1 | import { Size } from "types"; |
| 2 | |
| 3 | export const nodeSize = (node: SceneNode): Size => { |
| 4 | if ("layoutSizingHorizontal" in node && "layoutSizingVertical" in node) { |
| 5 | const width = |
| 6 | node.layoutSizingHorizontal === "FILL" |
| 7 | ? "fill" |
| 8 | : node.layoutSizingHorizontal === "HUG" |
| 9 | ? null |
| 10 | : node.width; |
| 11 | |
| 12 | const height = |
| 13 | node.layoutSizingVertical === "FILL" |
| 14 | ? "fill" |
| 15 | : node.layoutSizingVertical === "HUG" |
| 16 | ? null |
| 17 | : node.height; |
| 18 | |
| 19 | return { width, height }; |
| 20 | } |
| 21 | |
| 22 | return { width: node.width, height: node.height }; |
| 23 | }; |
no outgoing calls
no test coverage detected