-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(tamagotchi): move settings a single window (#14)
* move settings to a new window * use custom menu * fix routing
- Loading branch information
1 parent
790189f
commit ca02572
Showing
10 changed files
with
244 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { join, resolve } from 'node:path' | ||
import { Download } from '@proj-airi/unplugin-download' | ||
import { DownloadLive2DSDK } from '@proj-airi/unplugin-live2d-sdk' | ||
import Vue from '@vitejs/plugin-vue' | ||
import UnoCss from 'unocss/vite' | ||
import VueRouter from 'unplugin-vue-router/vite' | ||
import { defineConfig } from 'vite' | ||
|
||
export default defineConfig({ | ||
optimizeDeps: { | ||
exclude: [ | ||
'@proj-airi/stage-ui/*', | ||
], | ||
}, | ||
resolve: { | ||
alias: { | ||
'@renderer': resolve(join('src', 'renderer', 'src')), | ||
'@proj-airi/stage-ui': resolve(join(import.meta.dirname, '..', 'stage-ui', 'dist')), | ||
'@proj-airi/stage-ui/stores': resolve(join(import.meta.dirname, '..', 'stage-ui', 'dist', 'stores')), | ||
}, | ||
}, | ||
plugins: [ | ||
Vue(), | ||
UnoCss(), | ||
VueRouter({ | ||
dts: resolve(import.meta.dirname, 'src/typed-router.d.ts'), | ||
routesFolder: 'src/renderer/src/pages', | ||
}), | ||
DownloadLive2DSDK(), | ||
Download('https://dist.ayaka.moe/live2d-models/hiyori_free_zh.zip', 'hiyori_free_zh.zip', 'assets/live2d/models'), | ||
Download('https://dist.ayaka.moe/live2d-models/hiyori_pro_zh.zip', 'hiyori_pro_zh.zip', 'assets/live2d/models'), | ||
], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,7 @@ | ||
<script setup lang="ts"> | ||
import { WidgetStage } from '@proj-airi/stage-ui/components' | ||
import { ref } from 'vue' | ||
import InteractiveArea from './components/InteractiveArea.vue' | ||
const dragDelay = ref(0) | ||
const isDragging = ref(false) | ||
function handleMouseDown() { | ||
dragDelay.value = window.setTimeout(() => { | ||
isDragging.value = true | ||
}, 500) | ||
} | ||
function handleMouseUp() { | ||
clearTimeout(dragDelay.value) | ||
isDragging.value = false | ||
} | ||
function handleMouseLeave() { | ||
isDragging.value = false | ||
} | ||
function handleMouseMove(event: MouseEvent) { | ||
if (isDragging.value) { | ||
window.electron.ipcRenderer.send('move-window', event.movementX, event.movementY) | ||
} | ||
} | ||
import { RouterView } from 'vue-router' | ||
</script> | ||
|
||
<template> | ||
<div relative max-h="[100vh]" max-w="[100vw]" p="2" flex="~ col" z-2 h-full overflow-hidden @mousedown="handleMouseDown" @mouseup="handleMouseUp" @mousemove="handleMouseMove" @mouseleave="handleMouseLeave"> | ||
<div relative h-full w-full items-end gap-2 class="view"> | ||
<WidgetStage h-full w-full flex-1 mb="<md:18" /> | ||
<InteractiveArea class="interaction-area block" pointer-events-none absolute bottom-0 w-full opacity-0 transition="opacity duration-250" /> | ||
</div> | ||
</div> | ||
<RouterView /> | ||
</template> | ||
|
||
<style scoped> | ||
.view { | ||
&:hover { | ||
.interaction-area { | ||
opacity: 1; | ||
pointer-events: auto; | ||
} | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
packages/stage-tamagotchi/src/renderer/src/pages/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<script setup lang="ts"> | ||
import { WidgetStage } from '@proj-airi/stage-ui/components' | ||
import { ref } from 'vue' | ||
import InteractiveArea from '../components/InteractiveArea.vue' | ||
const dragDelay = ref(0) | ||
const isDragging = ref(false) | ||
function handleMouseDown() { | ||
dragDelay.value = window.setTimeout(() => { | ||
isDragging.value = true | ||
}, 500) | ||
} | ||
function handleMouseUp() { | ||
clearTimeout(dragDelay.value) | ||
isDragging.value = false | ||
} | ||
function handleMouseLeave() { | ||
isDragging.value = false | ||
} | ||
function handleMouseMove(event: MouseEvent) { | ||
if (isDragging.value) { | ||
window.electron.ipcRenderer.send('move-window', event.movementX, event.movementY) | ||
} | ||
} | ||
</script> | ||
|
||
<template> | ||
<div relative max-h="[100vh]" max-w="[100vw]" p="2" flex="~ col" z-2 h-full overflow-hidden @mousedown="handleMouseDown" @mouseup="handleMouseUp" @mousemove="handleMouseMove" @mouseleave="handleMouseLeave"> | ||
<div relative h-full w-full items-end gap-2 class="view"> | ||
<WidgetStage h-full w-full flex-1 mb="<md:18" /> | ||
<InteractiveArea class="interaction-area block" pointer-events-none absolute bottom-0 w-full opacity-0 transition="opacity duration-250" /> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.view { | ||
&:hover { | ||
.interaction-area { | ||
opacity: 1; | ||
pointer-events: auto; | ||
} | ||
} | ||
} | ||
</style> |
Oops, something went wrong.