Ported cutiekeys followmouse mfm
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user