mirror of
https://github.com/keven1024/015.git
synced 2026-05-26 07:08:02 +00:00
fix(front): 使用 useDevicePixelRatio 优化 Pixi 组件的分辨率计算
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { Application } from 'vue3-pixi'
|
||||
import { useElementSize } from '@vueuse/core'
|
||||
import { useElementSize, useDevicePixelRatio } from '@vueuse/core'
|
||||
|
||||
export interface PixiExpose {
|
||||
app: Application
|
||||
@@ -21,8 +21,8 @@ const height = computed(() => {
|
||||
if (containerHeight.value > contentHeight.value) return contentHeight.value
|
||||
return contentHeight.value
|
||||
})
|
||||
const resolution = computed(() => window?.devicePixelRatio || 1)
|
||||
|
||||
const { pixelRatio } = useDevicePixelRatio()
|
||||
const resolution = computed(() => pixelRatio.value ?? 1)
|
||||
watchEffect(() => {
|
||||
if (app.value?.app?.renderer) {
|
||||
app.value?.app?.renderer?.resize(width.value, height.value)
|
||||
|
||||
Reference in New Issue
Block a user