fix(stage-web,stage-tamagotchi): width incorrect for model settings

This commit is contained in:
Neko Ayaka
2025-07-18 01:55:00 +08:00
parent 1c371a0f6a
commit e9a82388b6
4 changed files with 26 additions and 13 deletions
@@ -44,7 +44,7 @@ const {
<template>
<div flex class="relative h-[calc(100dvh-8rem)] flex-col-reverse md:flex-row">
<ModelSettings w="100% md:30%" h-fit overflow-y-scroll class="absolute bottom-0 right-0 top-0" :palette="palette" @extract-colors-from-model="extractColorsFromModel" />
<ModelSettings live-2d-settings-class="w-100% md:w-40% lg:w-30% xl:w-30% 2xl:w-30% h-fit overflow-y-scroll absolute bottom-0 right-0 top-0" :palette="palette" @extract-colors-from-model="extractColorsFromModel" />
</div>
<IconAnimation
@@ -44,7 +44,7 @@ const {
<template>
<div flex class="relative h-[calc(100dvh-8rem)] flex-col-reverse md:flex-row">
<ModelSettings w="100% md:30%" h-fit overflow-y-scroll class="absolute bottom-0 right-0 top-0" :palette="palette" @extract-colors-from-model="extractColorsFromModel" />
<ModelSettings live-2d-settings-class="w-100% md:w-40% lg:w-30% xl:w-30% 2xl:w-30% h-fit overflow-y-scroll absolute bottom-0 right-0 top-0" :palette="palette" @extract-colors-from-model="extractColorsFromModel" />
</div>
<IconAnimation
@@ -1,28 +1,27 @@
<script setup lang="ts">
import { Screen } from '@proj-airi/stage-ui/components'
import { useLive2d } from '@proj-airi/stage-ui/stores'
import { useElementBounding, useMouse } from '@vueuse/core'
import { useMouse } from '@vueuse/core'
import { storeToRefs } from 'pinia'
import { ref } from 'vue'
import { Live2DCanvas, Live2DModel } from '../../../Scenes'
const live2dContainerRef = ref<HTMLDivElement>()
const live2dCanvasRef = ref<InstanceType<typeof Live2DCanvas>>()
const { width, height } = useElementBounding(live2dContainerRef)
const { positionInPercentageString, scale } = storeToRefs(useLive2d())
const positionCursor = useMouse()
</script>
<template>
<div ref="live2dContainerRef" w="100%" h="100%">
<Screen v-slot="{ width, height }" relative min-h-70dvh>
<Live2DCanvas
v-slot="{ app }"
ref="live2dCanvasRef"
v-slot="{ app }"
:width="width"
:height="height"
:resolution="2"
max-h="100dvh"
:resolution="3"
rounded-full
>
<Live2DModel
:app="app"
@@ -39,5 +38,5 @@ const positionCursor = useMouse()
:scale="scale"
/>
</Live2DCanvas>
</div>
</Screen>
</template>
@@ -6,8 +6,10 @@ import Live2DScene from './Live2DScene.vue'
import { useSettings } from '../../../../stores/settings'
defineProps<{
const props = defineProps<{
palette: string[]
live2dSceneClass?: string | string[]
live2dSettingsClass?: string | string[]
}>()
defineEmits<{
@@ -20,8 +22,20 @@ const { stageView } = storeToRefs(useSettings())
<template>
<!-- Live2D component for 2D stage view -->
<template v-if="stageView === '2d'">
<Live2DScene />
<div flex="~ col gap-2">
<Live2DScene
:class="[
...(props.live2dSceneClass
? (typeof props.live2dSceneClass === 'string' ? [props.live2dSceneClass] : props.live2dSceneClass)
: []),
]"
/>
<div
flex="~ col gap-2" :class="[
...(props.live2dSettingsClass
? (typeof props.live2dSettingsClass === 'string' ? [props.live2dSettingsClass] : props.live2dSettingsClass)
: []),
]"
>
<Live2D :palette="palette" @extract-colors-from-model="$emit('extractColorsFromModel')" />
</div>
</template>