fix(stage-ui): AIRI in full resolution! fixed pixi.js resolution issue (#808)

airi in full resolution let's goooo
This commit is contained in:
Rin
2025-12-17 10:47:35 +08:00
committed by GitHub
parent 7c603d1477
commit 588978d9ef
@@ -35,8 +35,12 @@ async function initLive2DPixiStage(parent: HTMLDivElement) {
height: props.height * props.resolution,
backgroundAlpha: 0,
preserveDrawingBuffer: true,
autoDensity: false,
resolution: 1,
})
pixiApp.value.stage.scale.set(props.resolution)
pixiAppCanvas.value = pixiApp.value.view
// Set CSS styles to make canvas responsive to container
@@ -54,19 +58,15 @@ async function initLive2DPixiStage(parent: HTMLDivElement) {
function handleResize() {
if (pixiApp.value) {
// Update the internal rendering resolution
pixiApp.value.renderer.resize(props.width, props.height)
pixiApp.value.renderer.resize(props.width * props.resolution, props.height * props.resolution)
pixiApp.value.stage.scale.set(props.resolution)
}
// The CSS styles handle the display size, so we don't need to manually set view dimensions
}
watch([() => props.width, () => props.height], () => handleResize())
watch(() => props.resolution, (newScale) => {
if (pixiApp.value && newScale) {
pixiApp.value.renderer.resolution = newScale
handleResize() // Refresh the renderer
}
})
watch(() => props.resolution, () => handleResize())
onMounted(async () => containerRef.value && await initLive2DPixiStage(containerRef.value))
onUnmounted(() => pixiApp.value?.destroy())