hairyf / vue3-pixi

Lightweight and flexible Vue 3 library for creating PixiJS applications.
https://vue3-pixi.vercel.app/
MIT License
226 stars 23 forks source link

missing props in Application Component #41

Closed evan-lc closed 1 year ago

evan-lc commented 1 year ago

https://github.com/hairyf/vue3-pixi/blob/main/packages/vue3-pixi/src/components/application/index.ts There is no resizeTo props declartion pass to new _Application({ view: canvas.value, ...props })

ktitaro commented 1 year ago

As a potential solution, you may resize your application manually:

const app = useApplication()

const { clientWidth } = document.documentElement
const { clientHeight } = document.documentElement
const { innerWidth = 0, innerHeight = 0 } = window
const realWidth = Math.max(clientWidth, innerWidth)
const realHeight = Math.max(clientHeight, innerHeight)

app.view.style.width = `${realWidth}px`
app.view.style.height = `${realHeight}px`
hairyf commented 1 year ago

I usually bind through the useElementSize of vueuse, like this:

import { useElementSize } from '@vueuse/core'

const { width, height } = useElementSize(myElement)
<Application :width="width" :height="height">...</Application>

However, the Application component should support the resizeTo attribute, and I will fix it