fix(stage-tamagotchi): hide on hover

This commit is contained in:
Neko Ayaka
2025-06-30 02:12:27 +08:00
parent 8052462502
commit aa8f914f90
2 changed files with 9 additions and 5 deletions
@@ -80,7 +80,9 @@ export function useTauriWindowClickThrough(live2DLookAtDefault: MaybeRefOrGetter
live2dLookAtY.value = mousePos.value.y - windowFrame.value.origin.y
}
watch(mousePos, () => updateLive2DLookAt())
watch(mousePos, () => {
updateLive2DLookAt()
})
function updateIsCursorInside() {
isCursorInside.value
@@ -90,6 +92,10 @@ export function useTauriWindowClickThrough(live2DLookAtDefault: MaybeRefOrGetter
&& mousePos.value.y <= windowFrame.value.origin.y + windowFrame.value.size.height
}
watch([mousePos, windowFrame], () => {
updateIsCursorInside()
})
watch(isInitialized, async (initialized) => {
if (initialized) {
updateLive2DLookAt()
+2 -4
View File
@@ -24,12 +24,10 @@ const { width, height } = useWindowSize()
const centerPos = computed(() => ({ x: width.value / 2, y: height.value / 2 }))
const live2dFocusAt = ref<Point>(centerPos.value)
const isCursorInside = ref(false)
const shouldHideView = computed(() => isCursorInside.value && !windowStore.isControlActive && windowStore.isIgnoringMouseEvent)
const { listen } = useTauriEvent<AiriTamagotchiEvents>()
const { invoke } = useTauriCore()
const { live2dLookAtX, live2dLookAtY } = useTauriWindowClickThrough(centerPos)
const { live2dLookAtX, live2dLookAtY, isCursorInside } = useTauriWindowClickThrough(centerPos)
const shouldHideView = computed(() => isCursorInside.value && !windowStore.isControlActive && windowStore.isIgnoringMouseEvent)
const mcpStore = useMcpStore()
const { connected, serverCmd, serverArgs } = storeToRefs(mcpStore)