From 92d53f744111b1cb8b7c4a597bd61a2b44b7d2a4 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Tue, 26 Apr 2022 22:26:22 +0200 Subject: [PATCH 1/2] add x,y parameters to rotate MFM --- packages/client/src/components/mfm.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/client/src/components/mfm.ts b/packages/client/src/components/mfm.ts index 37076652fd..0099eb4654 100644 --- a/packages/client/src/components/mfm.ts +++ b/packages/client/src/components/mfm.ts @@ -178,8 +178,12 @@ export default defineComponent({ return h(MkSparkle, {}, genEl(token.children)); } case 'rotate': { + const rotateDir = + token.props.args.x ? 'X' : + token.props.args.y ? 'Y' : + ''; const degrees = parseInt(token.props.args.deg) || '90'; - style = `transform: rotate(${degrees}deg); transform-origin: center center;`; + style = `transform: rotate${rotateDir}(${degrees}deg); transform-origin: center center;`; break; } } From f68a2c0881b503d3c2bab3cc9ca8a451aded0a40 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Wed, 27 Apr 2022 17:25:27 +0200 Subject: [PATCH 2/2] add perspective --- packages/client/src/components/mfm.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/client/src/components/mfm.ts b/packages/client/src/components/mfm.ts index 0099eb4654..49bd8d8c42 100644 --- a/packages/client/src/components/mfm.ts +++ b/packages/client/src/components/mfm.ts @@ -178,12 +178,12 @@ export default defineComponent({ return h(MkSparkle, {}, genEl(token.children)); } case 'rotate': { - const rotateDir = - token.props.args.x ? 'X' : - token.props.args.y ? 'Y' : - ''; + const rotate = + token.props.args.x ? 'perspective(128px) rotateX' : + token.props.args.y ? 'perspective(128px) rotateY' : + 'rotate'; const degrees = parseInt(token.props.args.deg) || '90'; - style = `transform: rotate${rotateDir}(${degrees}deg); transform-origin: center center;`; + style = `transform: ${rotate}(${degrees}deg); transform-origin: center center;`; break; } }