|
1 | 1 | import { Component, CUSTOM_ELEMENTS_SCHEMA, Input } from '@angular/core';
|
2 | 2 | import { Meta, moduleMetadata, StoryObj } from '@storybook/angular';
|
3 |
| -import { NgtsCubicBezierLine, NgtsLine, NgtsQuadraticBezierLine } from 'angular-three-soba/abstractions'; |
| 3 | +import { |
| 4 | + NgtsCatmullRomLine, |
| 5 | + NgtsCubicBezierLine, |
| 6 | + NgtsLine, |
| 7 | + NgtsQuadraticBezierLine, |
| 8 | +} from 'angular-three-soba/abstractions'; |
4 | 9 | import { NgtsOrbitControls } from 'angular-three-soba/controls';
|
5 | 10 | import * as THREE from 'three';
|
6 | 11 | import { GeometryUtils } from 'three-stdlib';
|
@@ -48,35 +53,35 @@ const defaultCatmullRom = {
|
48 | 53 | curveType: 'centripetal',
|
49 | 54 | };
|
50 | 55 |
|
51 |
| -// @Component({ |
52 |
| -// standalone: true, |
53 |
| -// template: ` |
54 |
| -// <ngts-catmull-rom-line |
55 |
| -// [points]="points" |
56 |
| -// [closed]="closed" |
57 |
| -// [curveType]="curveType" |
58 |
| -// [tension]="tension" |
59 |
| -// [segments]="segments" |
60 |
| -// [color]="color" |
61 |
| -// [lineWidth]="lineWidth" |
62 |
| -// [dashed]="dashed" |
63 |
| -// /> |
64 |
| -// <ngts-orbit-controls [zoomSpeed]="0.5" /> |
65 |
| -// `, |
66 |
| -// imports: [NgtsCatmullRomLine, NgtsOrbitControls], |
67 |
| -// schemas: [CUSTOM_ELEMENTS_SCHEMA], |
68 |
| -// }) |
69 |
| -// class CatmullRomLineStory { |
70 |
| -// readonly points = defaultCatmullRom.points; |
71 |
| -// @Input() color = 'red'; |
72 |
| -// @Input() lineWidth = 3; |
73 |
| -// @Input() dashed = false; |
74 |
| -// @Input() segments = defaultCatmullRom.segments; |
75 |
| -// @Input() closed = defaultCatmullRom.closed; |
76 |
| -// @Input() curveType = defaultCatmullRom.curveType; |
77 |
| -// @Input() tension = defaultCatmullRom.tension; |
78 |
| -// } |
79 |
| -// |
| 56 | +@Component({ |
| 57 | + standalone: true, |
| 58 | + template: ` |
| 59 | + <ngts-catmull-rom-line |
| 60 | + [points]="points" |
| 61 | + [closed]="closed" |
| 62 | + [curveType]="curveType" |
| 63 | + [tension]="tension" |
| 64 | + [segments]="segments" |
| 65 | + [color]="color" |
| 66 | + [lineWidth]="lineWidth" |
| 67 | + [dashed]="dashed" |
| 68 | + /> |
| 69 | + <ngts-orbit-controls [zoomSpeed]="0.5" /> |
| 70 | + `, |
| 71 | + imports: [NgtsCatmullRomLine, NgtsOrbitControls], |
| 72 | + schemas: [CUSTOM_ELEMENTS_SCHEMA], |
| 73 | +}) |
| 74 | +class CatmullRomLineStory { |
| 75 | + readonly points = defaultCatmullRom.points; |
| 76 | + @Input() color = 'red'; |
| 77 | + @Input() lineWidth = 3; |
| 78 | + @Input() dashed = false; |
| 79 | + @Input() segments = defaultCatmullRom.segments; |
| 80 | + @Input() closed = defaultCatmullRom.closed; |
| 81 | + @Input() curveType = defaultCatmullRom.curveType; |
| 82 | + @Input() tension = defaultCatmullRom.tension; |
| 83 | +} |
| 84 | + |
80 | 85 | @Component({
|
81 | 86 | standalone: true,
|
82 | 87 | template: `
|
@@ -179,54 +184,32 @@ export default {
|
179 | 184 | decorators: [moduleMetadata({ imports: [StorybookSetup] })],
|
180 | 185 | } as Meta;
|
181 | 186 |
|
| 187 | +const canvasOptions = { camera: { position: [0, 0, 17] }, controls: false }; |
| 188 | + |
182 | 189 | export const Default: StoryObj = {
|
183 |
| - render: makeRenderFunction(DefaultLineStory, { camera: { position: [0, 0, 17] }, controls: false }), |
| 190 | + render: makeRenderFunction(DefaultLineStory, canvasOptions), |
184 | 191 | args: { color: 'red', dashed: false, lineWidth: 3 },
|
185 | 192 | };
|
186 | 193 |
|
187 | 194 | export const VertexColors: StoryObj = {
|
188 |
| - render: makeRenderFunction(VertexColorsLineStory, { camera: { position: [0, 0, 17] }, controls: false }), |
| 195 | + render: makeRenderFunction(VertexColorsLineStory, canvasOptions), |
189 | 196 | args: { color: 'red', dashed: false, lineWidth: 3 },
|
190 | 197 | };
|
191 | 198 |
|
192 | 199 | export const CubicBezierLine: StoryObj = {
|
193 |
| - render: makeRenderFunction(CubicBezierLineStory, { camera: { position: [0, 0, 17] }, controls: false }), |
194 |
| - args: { |
195 |
| - ...defaultCubicBezier, |
196 |
| - color: 'red', |
197 |
| - lineWidth: 3, |
198 |
| - dashed: false, |
199 |
| - }, |
| 200 | + render: makeRenderFunction(CubicBezierLineStory, canvasOptions), |
| 201 | + args: { ...defaultCubicBezier, color: 'red', lineWidth: 3, dashed: false }, |
200 | 202 | };
|
201 | 203 |
|
202 | 204 | export const QuadraticBezierLine: StoryObj = {
|
203 |
| - render: makeRenderFunction(QuadraticBezierLineStory, { camera: { position: [0, 0, 17] }, controls: false }), |
204 |
| - args: { |
205 |
| - ...defaultQuadraticBezier, |
206 |
| - color: 'red', |
207 |
| - lineWidth: 3, |
208 |
| - dashed: false, |
| 205 | + render: makeRenderFunction(QuadraticBezierLineStory, canvasOptions), |
| 206 | + args: { ...defaultQuadraticBezier, color: 'red', lineWidth: 3, dashed: false }, |
| 207 | +}; |
| 208 | + |
| 209 | +export const CatmullRomLine: StoryObj = { |
| 210 | + render: makeRenderFunction(CatmullRomLineStory, canvasOptions), |
| 211 | + args: { ...defaultCatmullRom, color: 'red', lineWidth: 3, dashed: false }, |
| 212 | + argTypes: { |
| 213 | + curveType: { options: ['centripetal', 'chordal', 'catmullrom'], control: { type: 'select' } }, |
209 | 214 | },
|
210 | 215 | };
|
211 |
| -// |
212 |
| -// export const CatmullRomLine: StoryObj = { |
213 |
| -// render: (args) => ({ |
214 |
| -// props: { |
215 |
| -// story: CatmullRomLineStory, |
216 |
| -// options: makeCanvasOptions({ camera: { position: [0, 0, 17] }, controls: false }), |
217 |
| -// inputs: args, |
218 |
| -// }, |
219 |
| -// template: ` |
220 |
| -// <storybook-setup [story]="story" [options]="options" [inputs]="inputs" /> |
221 |
| -// `, |
222 |
| -// }), |
223 |
| -// args: { |
224 |
| -// ...defaultCatmullRom, |
225 |
| -// color: 'red', |
226 |
| -// lineWidth: 3, |
227 |
| -// dashed: false, |
228 |
| -// }, |
229 |
| -// argTypes: { |
230 |
| -// curveType: { options: ['centripetal', 'chordal', 'catmullrom'], control: { type: 'select' } }, |
231 |
| -// }, |
232 |
| -// }; |
0 commit comments