Skip to content

Commit 3c18936

Browse files
committed
feat(soba): staging
1 parent bf543ca commit 3c18936

File tree

5 files changed

+26
-22
lines changed

5 files changed

+26
-22
lines changed

Diff for: libs/soba/staging/src/lib/accumulative-shadows.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
Component,
55
DestroyRef,
66
ElementRef,
7-
afterNextRender,
87
computed,
98
effect,
109
inject,
@@ -139,7 +138,7 @@ export class NgtsAccumulativeShadows {
139138
constructor() {
140139
extend({ Group, SoftShadowMaterial, Mesh, PlaneGeometry });
141140

142-
afterNextRender(() => {
141+
effect(() => {
143142
this.pLM().configure(this.planeRef().nativeElement);
144143
});
145144

Diff for: libs/soba/staging/src/lib/bb-anchor.ts

+12-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
ChangeDetectionStrategy,
44
Component,
55
ElementRef,
6-
afterNextRender,
6+
effect,
77
input,
88
signal,
99
viewChild,
@@ -44,14 +44,17 @@ export class NgtsBBAnchor {
4444
// Reattach group created by this component to the parent's parent,
4545
// so it becomes a sibling of its initial parent.
4646
// We do that so the children have no impact on a bounding box of a parent.
47-
afterNextRender(() => {
48-
const bbAnchorLS = getLocalState(this.bbAnchorRef().nativeElement);
49-
const bbAnchorParent = bbAnchorLS?.parent();
50-
if (bbAnchorParent?.parent) {
51-
this.parent.set(bbAnchorParent);
52-
bbAnchorParent.parent.add(this.bbAnchorRef().nativeElement);
53-
}
54-
});
47+
effect(
48+
() => {
49+
const bbAnchorLS = getLocalState(this.bbAnchorRef().nativeElement);
50+
const bbAnchorParent = bbAnchorLS?.parent();
51+
if (bbAnchorParent?.parent) {
52+
this.parent.set(bbAnchorParent);
53+
bbAnchorParent.parent.add(this.bbAnchorRef().nativeElement);
54+
}
55+
},
56+
{ allowSignalWrites: true },
57+
);
5558

5659
injectBeforeRender(() => {
5760
const parent = this.parent();

Diff for: libs/soba/staging/src/lib/environment/environment.ts

+10-7
Original file line numberDiff line numberDiff line change
@@ -376,14 +376,17 @@ export class NgtsEnvironmentGround {
376376
selector: 'ngts-environment',
377377
standalone: true,
378378
template: `
379-
@if (options().ground) {
380-
<ngts-environment-ground [options]="options()" (envSet)="envSet.emit()" />
381-
} @else if (options().map) {
382-
<ngts-environment-map [options]="options()" (envSet)="envSet.emit()" />
383-
} @else if (content()) {
384-
<ngts-environment-portal [options]="options()" [content]="$any(content())" (envSet)="envSet.emit()" />
379+
@let _options = options();
380+
@let _content = content();
381+
382+
@if (_options.ground) {
383+
<ngts-environment-ground [options]="_options" (envSet)="envSet.emit()" />
384+
} @else if (_options.map) {
385+
<ngts-environment-map [options]="_options" (envSet)="envSet.emit()" />
386+
} @else if (_content) {
387+
<ngts-environment-portal [options]="_options" [content]="_content" (envSet)="envSet.emit()" />
385388
} @else {
386-
<ngts-environment-cube [options]="options()" (envSet)="envSet.emit()" />
389+
<ngts-environment-cube [options]="_options" (envSet)="envSet.emit()" />
387390
}
388391
`,
389392
imports: [NgtsEnvironmentCube, NgtsEnvironmentMap, NgtsEnvironmentPortal, NgtsEnvironmentGround],

Diff for: libs/soba/staging/src/lib/matcap-texture.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import {
66
Signal,
77
TemplateRef,
88
ViewContainerRef,
9-
afterNextRender,
109
computed,
10+
effect,
1111
inject,
1212
input,
1313
output,
@@ -102,7 +102,7 @@ export class NgtsMatcapTexture {
102102
onLoad: this.matcapTextureLoaded.emit.bind(this.matcapTextureLoaded),
103103
});
104104

105-
afterNextRender(() => {
105+
effect(() => {
106106
untracked(() => {
107107
this.ref = this.vcr.createEmbeddedView(this.template, { $implicit: texture });
108108
this.ref.detectChanges();

Diff for: libs/soba/staging/src/lib/normal-texture.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
Signal,
77
TemplateRef,
88
ViewContainerRef,
9-
afterNextRender,
109
computed,
1110
effect,
1211
inject,
@@ -107,7 +106,7 @@ export class NgtsNormalTexture {
107106
onLoad: this.normalTextureLoaded.emit.bind(this.normalTextureLoaded),
108107
});
109108

110-
afterNextRender(() => {
109+
effect(() => {
111110
untracked(() => {
112111
this.ref = this.vcr.createEmbeddedView(this.template, { $implicit: texture });
113112
this.ref.detectChanges();

0 commit comments

Comments
 (0)