Closed userquin closed 6 months ago
Right now there is no way to access the TresCanvas context without hacking the script setup using TresCanvas:
Add default slot props, we¡ve the default slot there without any binding:
<canvas ref="canvas" :data-scene="scene.uuid" :class="$attrs.class" :data-tres="`tresjs ${pkg.version}`" :style="{ display: 'block', width: '100%', height: '100%', position: windowSize ? 'fixed' : 'relative', top: 0, left: 0, pointerEvents: 'auto', touchAction: 'none', ...$attrs.style as Object, }" > <slot v-bind="context" /> </canvas>
then in the sfc template:
<TresCanvas shadows alpha v-slot="{ camera, renderer }"> <TresPerspectiveCamera :position="[5, 5, 5]" /> <TresOrbitControls v-if="renderer" :args="[camera, renderer.domElement]" /> </TresCanvas>
check the hack in the description
related #565
Closed as duplicate. See #572 .
Description
Right now there is no way to access the TresCanvas context without hacking the script setup using TresCanvas:
Hack
```htmlSuggested solution
Add default slot props, we¡ve the default slot there without any binding:
then in the sfc template:
Alternative
check the hack in the description
Additional context
related #565
Validations