Skip to content

Commit

Permalink
fix(stage-tamagotchi): drag issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nekomeowww committed Feb 19, 2025
1 parent eaec854 commit bf2d384
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/stage-tamagotchi/src/renderer/src/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
<script setup lang="ts">
import { WidgetStage } from '@proj-airi/stage-ui/components'
import { refDebounced } from '@vueuse/shared'
import { ref } from 'vue'
import InteractiveArea from '../components/InteractiveArea.vue'
const dragDelay = ref(0)
const isDragging = ref(false)
const isDraggingDebounced = refDebounced(isDragging, 100)
function handleMouseDown() {
dragDelay.value = window.setTimeout(() => {
isDragging.value = true
}, 500)
isDragging.value = true
}
function handleMouseUp() {
clearTimeout(dragDelay.value)
isDragging.value = false
}
Expand All @@ -23,7 +21,7 @@ function handleMouseLeave() {
}
function handleMouseMove(event: MouseEvent) {
if (isDragging.value) {
if (isDraggingDebounced.value) {
window.electron.ipcRenderer.send('move-window', event.movementX, event.movementY)
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/stage-ui/src/components/Live2D/Canvas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function handleResize() {
}
watch([() => props.width, () => props.height], () => handleResize())
onMounted(async () => containerRef.value && await initLive2DPixiStage(containerRef.value))
onUnmounted(() => pixiApp.value?.destroy())
</script>
Expand Down

0 comments on commit bf2d384

Please sign in to comment.