@@ -11,7 +11,7 @@ import {
1111 viewChild ,
1212} from '@angular/core' ;
1313import { Meta } from '@storybook/angular' ;
14- import { NgtArgs , NgtThreeEvent } from 'angular-three' ;
14+ import { NgtArgs } from 'angular-three' ;
1515import { NgtsPerspectiveCamera } from 'angular-three-soba/cameras' ;
1616import { NgtsOrbitControls } from 'angular-three-soba/controls' ;
1717import { injectTexture } from 'angular-three-soba/loaders' ;
@@ -62,24 +62,26 @@ class LoopOverInstancedBufferAttribute {
6262
6363 <ngt-directional-light [position]="[1, -1, 1]" [intensity]="Math.PI" />
6464
65- <ngt-mesh #mesh (click)="onClick($any($event))" >
65+ <ngt-mesh #mesh>
6666 <ngt-sphere-geometry *args="[3, 32, 32]" />
6767 <ngt-mesh-physical-material color="tomato" [roughness]="0.5" />
6868 </ngt-mesh>
6969
70- <decal-loop-over-instanced-buffer-attribute [buffer]="bufferAttribute()">
71- <ngts-decal *="let options" [mesh]="$any(mesh)" [options]="options">
72- <ngt-mesh-physical-material
73- [roughness]="0.2"
74- [transparent]="true"
75- [depthTest]="false"
76- [map]="Math.random() > 0.5 ? decals()?.reactMap : decals()?.threeMap"
77- [alphaTest]="0"
78- [polygonOffset]="true"
79- [polygonOffsetFactor]="-10"
80- />
81- </ngts-decal>
82- </decal-loop-over-instanced-buffer-attribute>
70+ @if (decals(); as decals) {
71+ <decal-loop-over-instanced-buffer-attribute [buffer]="bufferAttribute()">
72+ <ngts-decal *="let options" [mesh]="meshRef()" [options]="options">
73+ <ngt-mesh-physical-material
74+ [roughness]="0.2"
75+ [transparent]="true"
76+ [depthTest]="false"
77+ [map]="Math.random() > 0.5 ? decals.reactMap : decals.threeMap"
78+ [alphaTest]="0"
79+ [polygonOffset]="true"
80+ [polygonOffsetFactor]="-10"
81+ />
82+ </ngts-decal>
83+ </decal-loop-over-instanced-buffer-attribute>
84+ }
8385 ` ,
8486 schemas : [ CUSTOM_ELEMENTS_SCHEMA ] ,
8587 changeDetection : ChangeDetectionStrategy . OnPush ,
@@ -108,10 +110,6 @@ class DefaultDecalStory {
108110 dummy . lookAt ( p . add ( normal ) ) ;
109111 } ,
110112 } ) ) ;
111-
112- onClick ( event : NgtThreeEvent < PointerEvent > ) {
113- console . log ( event ) ;
114- }
115113}
116114
117115export default {
0 commit comments