Skip to content

Commit

Permalink
fix: temporaly cast the disableRender prop (#322)
Browse files Browse the repository at this point in the history
* fix: temporaly cast the `disableRender` prop

* chore: add comment for refactor
  • Loading branch information
alvarosabu committed Jun 27, 2023
1 parent 8ae3190 commit 9cc63d2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/TresScene.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App, defineComponent, h, onMounted, onUnmounted, ref, watch } from 'vue'
import { App, computed, defineComponent, h, onMounted, onUnmounted, ref, watch, watchEffect } from 'vue'

Check warning on line 1 in src/components/TresScene.ts

View workflow job for this annotation

GitHub Actions / Lint

'watchEffect' is defined but never used
import * as THREE from 'three'
import { ColorSpace, ShadowMapType, ToneMapping } from 'three'
import { createTres } from '../core/renderer'
Expand Down Expand Up @@ -64,6 +64,9 @@ export const TresScene = defineComponent<TresSceneProps>({
logWarning('physicallyCorrectLights is deprecated, useLegacyLights is now false by default')
}

// TODO: refactor this when this component is refactored to SFC (single file component)
const isRenderDisabled = computed(() => props.disableRender !== false && props.disableRender !== undefined)

const container = ref<HTMLElement>()
const canvas = ref<HTMLElement>()

Expand Down Expand Up @@ -115,7 +118,7 @@ export const TresScene = defineComponent<TresSceneProps>({
}

onLoop(() => {
if (activeCamera.value && props.disableRender !== true) renderer.value?.render(scene, activeCamera.value)
if (activeCamera.value && !isRenderDisabled.value) renderer.value?.render(scene, activeCamera.value)
})
}

Expand Down

0 comments on commit 9cc63d2

Please sign in to comment.