1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-23 20:02:32 +08:00

intersectMode for raycaster

This commit is contained in:
Kevin Levron 2021-04-03 00:59:58 +02:00
parent d11c2fe247
commit 8c5674b48f

View File

@ -9,6 +9,7 @@ export default {
onPointerMove: { type: Function, default: () => {} },
onPointerLeave: { type: Function, default: () => {} },
onClick: { type: Function, default: () => {} },
intersectMode: { type: String, default: 'move' },
},
mounted() {
this.rendererComponent.onMounted(() => {
@ -23,10 +24,17 @@ export default {
onIntersectClick: this.onClick,
});
this.pointer.addListeners();
if (this.intersectMode === 'frame') {
this.three.onBeforeRender(this.pointer.intersect);
}
});
},
unmounted() {
if (this.pointer) this.pointer.removeListeners();
if (this.pointer) {
this.pointer.removeListeners();
this.three.offBeforeRender(this.pointer.intersect);
}
},
methods: {
getIntersectObjects() {