Closed RuthySheffi closed 2 weeks ago
Hey @RuthySheffi, thanks for the issue and reproduction.
Possibly related, there seems to be an issue with events not being added to v-if
'd nodes:
When visible, the on-screen mesh should log to the console when clicked.
When visible and clicked, the mesh does not log to the console.
<!-- eslint-disable no-console -->
<script setup lang="ts">
import { shallowRef } from 'vue';
import { useLoop } from '@tresjs/core';
const tOrF = shallowRef(false);
useLoop().onBeforeRender(({ elapsed: _elapsed }) => {
tOrF.value = !!(Math.floor(_elapsed) % 2);
});
</script>
<template>
<TresMesh v-if="tOrF" @click="console.log">
<TresSphereGeometry />
<TresMeshNormalMaterial />
</TresMesh>
</template>
Note that the code above logs to console if the v-if
is removed.
@garrlker
Describe the bug
Description:
I am experiencing an issue where events on dynamically added spheres are not being registered. In my setup, I have a box that, when clicked, adds a new sphere to the scene. While the initial spheres respond to click, pointer-enter, and pointer-leave events as expected, the newly added spheres do not trigger these events.
Sample Code:
Expected Behavior:
The click, pointer-enter, and pointer-leave events on the newly added spheres should function identically to those on the initial spheres, triggering the respective console logs and scaling effects.
Reproduction
https://stackblitz.com/edit/tresjs-minimal-reproduction-aa972s?file=src%2Fcomponents%2FTheExperience.vue,package-lock.json
Steps to reproduce
No response
System Info
No response
Used Package Manager
npm
Code of Conduct