fix (client): missing MFM function props not falling back correctly

This commit is contained in:
naskya 2024-05-05 01:15:04 +09:00
parent 4992999bb7
commit 6d64358674
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C

View file

@ -283,44 +283,44 @@ export default defineComponent({
? "perspective(128px) rotateY" ? "perspective(128px) rotateY"
: "rotate"; : "rotate";
const degrees = Number.parseFloat( const degrees = Number.parseFloat(
token.props.args.deg.toString() ?? "90", (token.props.args.deg ?? "90").toString(),
); );
style = `transform: ${rotate}(${degrees}deg); transform-origin: center center;`; style = `transform: ${rotate}(${degrees}deg); transform-origin: center center;`;
break; break;
} }
case "position": { case "position": {
const x = Number.parseFloat( const x = Number.parseFloat(
token.props.args.x.toString() ?? "0", (token.props.args.x ?? "0").toString(),
); );
const y = Number.parseFloat( const y = Number.parseFloat(
token.props.args.y.toString() ?? "0", (token.props.args.y ?? "0").toString(),
); );
style = `transform: translateX(${x}em) translateY(${y}em);`; style = `transform: translateX(${x}em) translateY(${y}em);`;
break; break;
} }
case "crop": { case "crop": {
const top = Number.parseFloat( const top = Number.parseFloat(
token.props.args.top.toString() ?? "0", (token.props.args.top ?? "0").toString(),
); );
const right = Number.parseFloat( const right = Number.parseFloat(
token.props.args.right.toString() ?? "0", (token.props.args.right ?? "0").toString(),
); );
const bottom = Number.parseFloat( const bottom = Number.parseFloat(
token.props.args.bottom.toString() ?? "0", (token.props.args.bottom ?? "0").toString(),
); );
const left = Number.parseFloat( const left = Number.parseFloat(
token.props.args.left.toString() ?? "0", (token.props.args.left ?? "0").toString(),
); );
style = `clip-path: inset(${top}% ${right}% ${bottom}% ${left}%);`; style = `clip-path: inset(${top}% ${right}% ${bottom}% ${left}%);`;
break; break;
} }
case "scale": { case "scale": {
const x = Math.min( const x = Math.min(
Number.parseFloat(token.props.args.x.toString() ?? "1"), Number.parseFloat((token.props.args.x ?? "1").toString()),
5, 5,
); );
const y = Math.min( const y = Math.min(
Number.parseFloat(token.props.args.y.toString() ?? "1"), Number.parseFloat((token.props.args.y ?? "1").toString()),
5, 5,
); );
style = `transform: scale(${x}, ${y});`; style = `transform: scale(${x}, ${y});`;