|
@@ -1,3 +1,4 @@
|
|
|
+import { watch, watchEffect } from 'vue'
|
|
|
/* eslint-disable max-len */
|
|
|
import { watch, ref, shallowRef, computed, toRefs } from 'vue'
|
|
|
import {
|
|
@@ -152,11 +153,16 @@ export function useRenderer(canvas: MaybeElementRef, container: MaybeElementRef,
|
|
|
const { setState } = useTres()
|
|
|
|
|
|
const { width, height } = resolveUnref(windowSize) ? useWindowSize() : useElementSize(container)
|
|
|
- const { logError } = useLogger()
|
|
|
+ const { logError, logWarning } = useLogger()
|
|
|
const { pixelRatio } = useDevicePixelRatio()
|
|
|
const { pause, resume } = useRenderLoop()
|
|
|
const aspectRatio = computed(() => width.value / height.value)
|
|
|
|
|
|
+ if (!resolveUnref(windowSize) && container?.value?.offsetHeight === 0) {
|
|
|
+ logWarning(`Oops... Seems like your canvas height is currently 0px, by default it takes the height of it's parent, so make sure it has some height with CSS.
|
|
|
+You could set windowSize=true to force the canvas to be the size of the window.`)
|
|
|
+ }
|
|
|
+
|
|
|
const updateRendererSize = () => {
|
|
|
if (!renderer.value) {
|
|
|
return
|