Skip to content

Commit bf7fc1c

Browse files
committed
docs: adjust setup canvas
1 parent b9d76ca commit bf7fc1c

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

libs/soba/src/misc/html.stories.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Meta } from '@storybook/angular';
33
import { NgtArgs } from 'angular-three';
44
import { NgtsHTML, NgtsHTMLContent, NgtsHTMLContentOptions, NgtsHTMLOptions } from 'angular-three-soba/misc';
55
import { ColorRepresentation } from 'three';
6-
import { makeDecorators, makeStoryObject, Turnable } from '../setup-canvas';
6+
import { makeDecorators, makeStoryFunction, makeStoryObject, Turnable } from '../setup-canvas';
77

88
@Component({
99
selector: 'html-scene',
@@ -85,10 +85,7 @@ export default {
8585
decorators: makeDecorators(),
8686
} as Meta;
8787

88-
export const Default = makeStoryObject(HtmlScene, {
89-
canvasOptions: { camera: { position: [-20, 20, -20] } },
90-
});
91-
88+
export const Default = makeStoryFunction(HtmlScene, { camera: { position: [-20, 20, -20] } });
9289
export const Transform = makeStoryObject(HtmlTransformScene, {
9390
canvasOptions: { camera: { position: [-20, 20, -20] } },
9491
argsOptions: {

libs/soba/src/setup-canvas.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
effect,
1919
inject,
2020
input,
21+
isSignal,
2122
reflectComponentType,
2223
untracked,
2324
viewChild,
@@ -128,8 +129,17 @@ export class StorybookScene {
128129
this.inputsMirror = this.storyMirror.inputs.map((input) => input.propName);
129130
}
130131

132+
const component = this.ref.instance as any;
133+
131134
for (const key of this.inputsMirror) {
132-
this.ref.setInput(key, options[key]);
135+
const signalInput = component[key];
136+
const isSignalInput = signalInput && isSignal(signalInput);
137+
const value =
138+
isSignalInput && options[key] === undefined && untracked(signalInput) !== undefined
139+
? untracked(signalInput)
140+
: options[key];
141+
142+
this.ref.setInput(key, value);
133143
}
134144
}
135145
}

0 commit comments

Comments
 (0)