Skip to content

Commit

Permalink
fix: remove wrapper element on unmounted (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarosabu authored Dec 13, 2023
1 parent 27ce1f0 commit 1a37c92
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion playground/src/pages/misc/HTMLDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { ref, reactive } from 'vue'
import { TresCanvas } from '@tresjs/core'
import { BasicShadowMap, SRGBColorSpace, NoToneMapping } from 'three'
import { TresLeches, useControls } from '@tresjs/leches'
import '@tresjs/leches/styles'
import { OrbitControls, Html } from '@tresjs/cientos'
import Card from './Card.vue'
Expand All @@ -26,9 +26,13 @@ const state = reactive({
})
const isActive = ref(false)
const { showHtml } = useControls({
showHtml: false,
})
</script>

<template>
<TresLeches />
<TresCanvas v-bind="gl">
<TresPerspectiveCamera :position="[3, 0, 8]" />
<OrbitControls />
Expand All @@ -39,6 +43,7 @@ const isActive = ref(false)
<TresBoxGeometry />
<TresMeshNormalMaterial />
<Html
v-if="showHtml"
v-bind="state"
transform
:occlude="[sphereRef]"
Expand Down
1 change: 1 addition & 0 deletions src/core/misc/html/HTML.vue
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ onUnmounted(() => {
if (shaderMaterial.value) {
shaderMaterial.value.dispose()
}
el.value.remove()
})
</script>

Expand Down

0 comments on commit 1a37c92

Please sign in to comment.