Skip to content

Commit 8abcfaa

Browse files
fix rotation & relative transform mapping & css gen - applies to vanilla, react, and other web based platforms
1 parent c1031d9 commit 8abcfaa

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

externals/design-sdk

packages/designto-web/tokens-to-web-widget/compose-wrapped-with-rotation.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,18 @@ export function compose_wrapped_with_rotation(
77
child_composer: Composer
88
) {
99
const child = child_composer(widget.child);
10+
11+
const r = widget.rotation;
12+
// don't apply rotation if it's 0
13+
if (Math.abs(r) === 360 || Math.abs(r) === 360) {
14+
return child;
15+
}
16+
1017
child.extendStyle({
11-
transform: css.rotation(widget.rotation),
18+
// rotation data needs to be inverted
19+
transform: css.rotation(-widget.rotation),
20+
// this is where the figma's rotation data is originated from.
21+
"transform-origin": "top left",
1222
});
1323
return child;
1424
}

0 commit comments

Comments
 (0)