mirror of
https://iceshrimp.dev/Crimekillz/jointrashposs.git
synced 2024-11-22 00:43:50 +01:00
refactor(aichan): eliminate type error
This commit is contained in:
parent
0bf08f5b9d
commit
9832f0a60d
@ -16,9 +16,13 @@ if (process.client) {
|
||||
}
|
||||
|
||||
function initAiChan() {
|
||||
if (!live2d.value) return;
|
||||
|
||||
const iframeRect = live2d.value.getBoundingClientRect();
|
||||
window.addEventListener('mousemove', ev => {
|
||||
live2d.value?.contentWindow.postMessage({
|
||||
if (!live2d.value) return;
|
||||
|
||||
live2d.value.contentWindow?.postMessage({
|
||||
type: 'moveCursor',
|
||||
body: {
|
||||
x: ev.clientX - iframeRect.left,
|
||||
@ -27,7 +31,9 @@ function initAiChan() {
|
||||
}, '*');
|
||||
}, { passive: true });
|
||||
window.addEventListener('touchmove', ev => {
|
||||
live2d.value?.contentWindow.postMessage({
|
||||
if (!live2d.value) return;
|
||||
|
||||
live2d.value.contentWindow?.postMessage({
|
||||
type: 'moveCursor',
|
||||
body: {
|
||||
x: ev.touches[0].clientX - iframeRect.left,
|
||||
|
Loading…
Reference in New Issue
Block a user