Ported cutiekeys followmouse mfm
This commit is contained in:
parent
95ec40d3c8
commit
4c4b431248
5 changed files with 184 additions and 62 deletions
|
|
@ -6,6 +6,7 @@
|
|||
import { VNode, h, defineAsyncComponent, SetupContext } from 'vue';
|
||||
import * as mfm from '@transfem-org/sfm-js';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import CkFollowMouse from '../CkFollowMouse.vue';
|
||||
import MkUrl from '@/components/global/MkUrl.vue';
|
||||
import MkTime from '@/components/global/MkTime.vue';
|
||||
import MkLink from '@/components/MkLink.vue';
|
||||
|
|
@ -232,6 +233,28 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
|
|||
style = `transform: rotate(${degrees}deg); transform-origin: center center;`;
|
||||
break;
|
||||
}
|
||||
case 'followmouse': {
|
||||
// Make sure advanced MFM is on and that reduced motion is off
|
||||
if (!useAnim) {
|
||||
style = '';
|
||||
break;
|
||||
}
|
||||
|
||||
let x = (!!token.props.args.x);
|
||||
let y = (!!token.props.args.y);
|
||||
|
||||
if (!x && !y) {
|
||||
x = true;
|
||||
y = true;
|
||||
}
|
||||
|
||||
return h(CkFollowMouse, {
|
||||
x: x,
|
||||
y: y,
|
||||
speed: validTime(token.props.args.speed) ?? '0.1s',
|
||||
rotateByVelocity: !!token.props.args.rotateByVelocity,
|
||||
}, genEl(token.children, scale));
|
||||
}
|
||||
case 'position': {
|
||||
if (!defaultStore.state.advancedMfm) break;
|
||||
const x = safeParseFloat(token.props.args.x) ?? 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue