File tree Expand file tree Collapse file tree 7 files changed +41
-4
lines changed
packages/stage-ui/src/components Expand file tree Collapse file tree 7 files changed +41
-4
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ import { useI18n } from 'vue-i18n'
1010import MobileChatHistory from ' ../Widgets/MobileChatHistory.vue'
1111import MobileSettings from ' ../Widgets/MobileSettings.vue'
1212
13+ const emit = defineEmits <{
14+ (e : ' settingsOpen' , open : boolean ): void
15+ }>()
16+
1317const messageInput = ref (' ' )
1418const listening = ref (false )
1519
@@ -69,6 +73,10 @@ function handleTranscription(_buffer: Float32Array<ArrayBufferLike>) {
6973// selectedAudioDevice.value = found
7074// }
7175
76+ function handleSettingsOpen(open : boolean ) {
77+ emit (' settingsOpen' , open )
78+ }
79+
7280watch (isAudioInputOn , async (value ) => {
7381 if (value === ' false' ) {
7482 destroy ()
@@ -100,7 +108,7 @@ onMounted(() => {
100108 @submit =" handleSend"
101109 />
102110 </div >
103- <DrawerRoot should-scale-background >
111+ <DrawerRoot should-scale-background @update:open = " handleSettingsOpen " >
104112 <DrawerTrigger
105113 class =" px-4 py-2.5"
106114 border =" solid 2 pink-100 dark:pink-400/20"
Original file line number Diff line number Diff line change 11<script setup lang="ts">
22import { WidgetStage } from ' @proj-airi/stage-ui/components'
33import { useDark } from ' @vueuse/core'
4+ import { ref } from ' vue'
45
56import Cross from ' ../components/Backgrounds/Cross.vue'
67import AnimatedBackground from ' ../components/Layouts/AnimatedBackground.vue'
@@ -10,6 +11,11 @@ import MobileHeader from '../components/Layouts/MobileHeader.vue'
1011import MobileInteractiveArea from ' ../components/Layouts/MobileInteractiveArea.vue'
1112
1213const dark = useDark ()
14+ const paused = ref (false )
15+
16+ function handleSettingsOpen(open : boolean ) {
17+ paused .value = open
18+ }
1319 </script >
1420
1521<template >
@@ -23,9 +29,9 @@ const dark = useDark()
2329 </div >
2430 <!-- page -->
2531 <div relative flex =" ~ 1 row gap-y-0 gap-x-2 <md:col" >
26- <WidgetStage flex-1 min-w =" 1/2" />
32+ <WidgetStage flex-1 min-w =" 1/2" :paused = " paused " />
2733 <InteractiveArea class =" flex <md:hidden" flex-1 max-w =" 500px" min-w =" 30%" />
28- <MobileInteractiveArea class =" hidden <md:block" mx2 mb2 />
34+ <MobileInteractiveArea class =" hidden <md:block" mx2 mb2 @settings-open = " handleSettingsOpen " />
2935 </div >
3036 </div >
3137 </AnimatedBackground >
Original file line number Diff line number Diff line change @@ -20,11 +20,13 @@ const props = withDefaults(defineProps<{
2020 width: number
2121 height: number
2222 motion? : string
23+ paused: boolean
2324}>(), {
2425 mouthOpenSize: 0 ,
2526})
2627
2728const pixiApp = toRef (() => props .app )
29+ const paused = toRef (() => props .paused )
2830const model = ref <Live2DModel >()
2931const initialModelWidth = ref <number >(0 )
3032const initialModelHeight = ref <number >(0 )
@@ -141,6 +143,9 @@ watch(model, updateDropShadowFilter)
141143watch (mouthOpenSize , value => getCoreModel ().setParameterValueById (' ParamMouthOpenY' , value ))
142144watch (pixiApp , initLive2DPixiStage )
143145watch (() => props .motion , () => props .motion && setMotion (props .motion ))
146+ watch (paused , (value ) => {
147+ value ? pixiApp .value ?.stop () : pixiApp .value ?.start ()
148+ })
144149
145150onMounted (updateDropShadowFilter )
146151onUnmounted (() => model .value && pixiApp .value ?.stage .removeChild (model .value ))
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import TransitionVertical from '../TransitionVertical.vue'
1717
1818withDefaults (defineProps <{
1919 model: string
20+ paused: boolean
2021 mouthOpenSize? : number
2122}>(), {
2223 mouthOpenSize: 0 ,
@@ -29,7 +30,7 @@ const show = ref(false)
2930<template >
3031 <Screen v-slot =" { width, height }" relative >
3132 <Live2DCanvas v-slot =" { app }" :width =" width" :height =" height" >
32- <Live2DModel :app =" app" :model =" model" :mouth-open-size =" mouthOpenSize" :width =" width" :height =" height" :motion =" motion" />
33+ <Live2DModel :app =" app" :model =" model" :mouth-open-size =" mouthOpenSize" :width =" width" :height =" height" :motion =" motion" :paused = " paused " />
3334 </Live2DCanvas >
3435 <div absolute bottom =" 3" right =" 3" >
3536 <div flex =" ~ row" cursor-pointer >
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import VRMModel from '../VRM/Model.vue'
1212const props = defineProps <{
1313 model: string
1414 idleAnimation: string
15+ paused: boolean
1516}>()
1617
1718const emit = defineEmits <{
@@ -51,6 +52,7 @@ defineExpose({
5152 :model =" props.model"
5253 :idle-animation =" props.idleAnimation"
5354 :position =" [vrmModelPositionX, vrmModelPositionY, vrmModelPositionZ]"
55+ :paused =" props.paused"
5456 @load-model-progress =" (val) => emit('loadModelProgress', val)"
5557 @error =" (val) => emit('error', val)"
5658 />
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ const props = defineProps<{
1515 idleAnimation: string
1616 loadAnimations? : string []
1717 position: [number , number , number ]
18+ paused: boolean
1819}>()
1920
2021const emit = defineEmits <{
@@ -96,6 +97,12 @@ defineExpose({
9697 vrmEmote .value ?.setEmotionWithResetAfter (expression , 1000 )
9798 },
9899})
100+
101+ const { pause, resume } = useLoop ()
102+
103+ watch (() => props .paused , (value ) => {
104+ value ? pause () : resume ()
105+ })
99106 </script >
100107
101108<template >
Original file line number Diff line number Diff line change @@ -22,6 +22,12 @@ import VRMScene from '../Scenes/VRM.vue'
2222
2323import ' ../../utils/live2d-zip-loader'
2424
25+ withDefaults (defineProps <{
26+ paused? : boolean
27+ }>(), {
28+ paused: false ,
29+ })
30+
2531const vrmViewerRef = ref <{ setExpression: (expression : string ) => void }>()
2632
2733const motion = ref (' ' )
@@ -212,13 +218,15 @@ onMounted(() => {
212218 :mouth-open-size =" mouthOpenSize"
213219 model =" ./assets/live2d/models/hiyori_pro_zh.zip"
214220 min-w =" 50% <lg:full" min-h =" 100 sm:100" h-full w-full flex-1
221+ :paused =" paused"
215222 />
216223 <VRMScene
217224 v-else-if =" stageView === '3d'"
218225 ref =" vrmViewerRef"
219226 model =" /assets/vrm/models/AvatarSample-B/AvatarSample_B.vrm"
220227 idle-animation =" /assets/vrm/animations/idle_loop.vrma"
221228 min-w =" 50% <lg:full" min-h =" 100 sm:100" h-full w-full flex-1
229+ :paused =" paused"
222230 @error =" console.error"
223231 />
224232 </div >
You can’t perform that action at this time.
0 commit comments