angular-three-soba 1.3.2 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/abstractions/README.md +3 -0
  2. package/abstractions/index.d.ts +10 -0
  3. package/abstractions/lib/billboard/billboard.d.ts +14 -0
  4. package/abstractions/lib/catmull-rom-line/catmull-rom-line.d.ts +15 -0
  5. package/abstractions/lib/cubic-bezier-line/cubic-bezier-line.d.ts +15 -0
  6. package/abstractions/lib/gizmo-helper/gizmo-helper.d.ts +41 -0
  7. package/abstractions/lib/gizmo-helper/gizmo-viewcube/constants.d.ts +12 -0
  8. package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.d.ts +16 -0
  9. package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.d.ts +24 -0
  10. package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.d.ts +14 -0
  11. package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube.d.ts +15 -0
  12. package/abstractions/lib/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.d.ts +28 -0
  13. package/abstractions/lib/gizmo-helper/gizmo-viewport/gizmo-viewport.d.ts +21 -0
  14. package/abstractions/lib/line/line-input.d.ts +19 -0
  15. package/abstractions/lib/line/line.d.ts +21 -0
  16. package/abstractions/lib/quadratic-bezier-line/quadratic-bezier-line.d.ts +19 -0
  17. package/abstractions/lib/text/text.d.ts +21 -0
  18. package/abstractions/lib/text-3d/text-3d.d.ts +39 -0
  19. package/esm2020/abstractions/angular-three-soba-abstractions.mjs +5 -0
  20. package/esm2020/abstractions/index.mjs +11 -0
  21. package/esm2020/abstractions/lib/billboard/billboard.mjs +73 -0
  22. package/esm2020/abstractions/lib/catmull-rom-line/catmull-rom-line.mjs +119 -0
  23. package/esm2020/abstractions/lib/cubic-bezier-line/cubic-bezier-line.mjs +98 -0
  24. package/esm2020/abstractions/lib/gizmo-helper/gizmo-helper.mjs +206 -0
  25. package/esm2020/abstractions/lib/gizmo-helper/gizmo-viewcube/constants.mjs +31 -0
  26. package/esm2020/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.mjs +91 -0
  27. package/esm2020/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.mjs +182 -0
  28. package/esm2020/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.mjs +45 -0
  29. package/esm2020/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube.mjs +133 -0
  30. package/esm2020/abstractions/lib/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.mjs +193 -0
  31. package/esm2020/abstractions/lib/gizmo-helper/gizmo-viewport/gizmo-viewport.mjs +266 -0
  32. package/esm2020/abstractions/lib/line/line-input.mjs +75 -0
  33. package/esm2020/abstractions/lib/line/line.mjs +147 -0
  34. package/esm2020/abstractions/lib/quadratic-bezier-line/quadratic-bezier-line.mjs +127 -0
  35. package/esm2020/abstractions/lib/text/text.mjs +110 -0
  36. package/esm2020/abstractions/lib/text-3d/text-3d.mjs +144 -0
  37. package/esm2020/cameras/lib/orthographic-camera/orthographic-camera.mjs +5 -5
  38. package/esm2020/staging/index.mjs +3 -1
  39. package/esm2020/staging/lib/camera-shake/camera-shake.mjs +121 -0
  40. package/esm2020/staging/lib/cloud/cloud.mjs +159 -0
  41. package/fesm2015/angular-three-soba-abstractions.mjs +1965 -0
  42. package/fesm2015/angular-three-soba-abstractions.mjs.map +1 -0
  43. package/fesm2015/angular-three-soba-cameras.mjs +4 -4
  44. package/fesm2015/angular-three-soba-cameras.mjs.map +1 -1
  45. package/fesm2015/angular-three-soba-staging.mjs +274 -4
  46. package/fesm2015/angular-three-soba-staging.mjs.map +1 -1
  47. package/fesm2020/angular-three-soba-abstractions.mjs +1962 -0
  48. package/fesm2020/angular-three-soba-abstractions.mjs.map +1 -0
  49. package/fesm2020/angular-three-soba-cameras.mjs +4 -4
  50. package/fesm2020/angular-three-soba-cameras.mjs.map +1 -1
  51. package/fesm2020/angular-three-soba-staging.mjs +274 -4
  52. package/fesm2020/angular-three-soba-staging.mjs.map +1 -1
  53. package/package.json +11 -3
  54. package/plugin/package.json +1 -1
  55. package/staging/index.d.ts +2 -0
  56. package/staging/lib/camera-shake/camera-shake.d.ts +28 -0
  57. package/staging/lib/cloud/cloud.d.ts +23 -0
@@ -0,0 +1,1962 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Component, CUSTOM_ELEMENTS_SCHEMA, Input, Directive, inject, InjectionToken, EventEmitter, TemplateRef, Output, ContentChild } from '@angular/core';
3
+ import { extend, NgtRxStore, injectNgtRef, NgtStore, startWithUndefined, NgtArgs, NgtPortal, NgtPortalContent, NgtRepeat, NgtPush } from 'angular-three';
4
+ import * as THREE from 'three';
5
+ import { Group, CatmullRomCurve3, Vector3, Quaternion, Object3D, Matrix4, Mesh, BoxGeometry, MeshBasicMaterial, MeshLambertMaterial, CanvasTexture, AmbientLight, PointLight, Sprite, SpriteMaterial } from 'three';
6
+ import { combineLatest, map, switchMap, of } from 'rxjs';
7
+ import { LineMaterial, LineSegmentsGeometry, LineGeometry, LineSegments2, Line2, TextGeometry, FontLoader } from 'three-stdlib';
8
+ import { NgIf, NgTemplateOutlet, DOCUMENT, NgFor } from '@angular/common';
9
+ import { selectSlice } from '@rx-angular/state';
10
+ import { NgtsOrthographicCamera } from 'angular-three-soba/cameras';
11
+ import { RxActionFactory } from '@rx-angular/state/actions';
12
+ import { Text, preloadFont } from 'troika-three-text';
13
+
14
+ extend({ Group });
15
+ class NgtsBillboard extends NgtRxStore {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.billboardRef = injectNgtRef();
19
+ }
20
+ set follow(follow) {
21
+ this.set({ follow });
22
+ }
23
+ set lockX(lockX) {
24
+ this.set({ lockX });
25
+ }
26
+ set lockY(lockY) {
27
+ this.set({ lockY });
28
+ }
29
+ set lockZ(lockZ) {
30
+ this.set({ lockZ });
31
+ }
32
+ initialize() {
33
+ super.initialize();
34
+ this.set({ follow: true, lockX: false, lockY: false, lockZ: false });
35
+ }
36
+ onBeforeRender(event) {
37
+ const { follow, lockX, lockY, lockZ } = this.get();
38
+ if (!follow)
39
+ return;
40
+ // save prev rotation in case we're locking axises
41
+ const prevRotation = event.object.rotation.clone();
42
+ // always face the camera
43
+ event.object.quaternion.copy(event.state.camera.quaternion);
44
+ // readjust any axis that is locked
45
+ if (lockX)
46
+ event.object.rotation.x = prevRotation.x;
47
+ if (lockY)
48
+ event.object.rotation.y = prevRotation.y;
49
+ if (lockZ)
50
+ event.object.rotation.z = prevRotation.z;
51
+ }
52
+ }
53
+ NgtsBillboard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsBillboard, deps: null, target: i0.ɵɵFactoryTarget.Component });
54
+ NgtsBillboard.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsBillboard, isStandalone: true, selector: "ngts-billboard", inputs: { billboardRef: "billboardRef", follow: "follow", lockX: "lockX", lockY: "lockY", lockZ: "lockZ" }, usesInheritance: true, ngImport: i0, template: `
55
+ <ngt-group ngtCompound [ref]="billboardRef" (beforeRender)="onBeforeRender($any($event))">
56
+ <ng-content />
57
+ </ngt-group>
58
+ `, isInline: true });
59
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsBillboard, decorators: [{
60
+ type: Component,
61
+ args: [{
62
+ selector: 'ngts-billboard',
63
+ standalone: true,
64
+ template: `
65
+ <ngt-group ngtCompound [ref]="billboardRef" (beforeRender)="onBeforeRender($any($event))">
66
+ <ng-content />
67
+ </ngt-group>
68
+ `,
69
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
70
+ }]
71
+ }], propDecorators: { billboardRef: [{
72
+ type: Input
73
+ }], follow: [{
74
+ type: Input
75
+ }], lockX: [{
76
+ type: Input
77
+ }], lockY: [{
78
+ type: Input
79
+ }], lockZ: [{
80
+ type: Input
81
+ }] } });
82
+
83
+ class NgtsLineInput extends NgtRxStore {
84
+ set vertexColors(vertexColors) {
85
+ this.set({ vertexColors });
86
+ }
87
+ set lineWidth(lineWidth) {
88
+ this.set({ lineWidth });
89
+ }
90
+ set alphaToCoverage(alphaToCoverage) {
91
+ this.set({ alphaToCoverage });
92
+ }
93
+ set color(color) {
94
+ this.set({ color });
95
+ }
96
+ set dashed(dashed) {
97
+ this.set({ dashed });
98
+ }
99
+ set dashScale(dashScale) {
100
+ this.set({ dashScale });
101
+ }
102
+ set dashSize(dashSize) {
103
+ this.set({ dashSize });
104
+ }
105
+ set dashOffset(dashOffset) {
106
+ this.set({ dashOffset });
107
+ }
108
+ set gapSize(gapSize) {
109
+ this.set({ gapSize });
110
+ }
111
+ set resolution(resolution) {
112
+ this.set({ resolution });
113
+ }
114
+ set wireframe(wireframe) {
115
+ this.set({ wireframe });
116
+ }
117
+ set worldUnits(worldUnits) {
118
+ this.set({ worldUnits });
119
+ }
120
+ initialize() {
121
+ super.initialize();
122
+ this.set({ color: 'black' });
123
+ }
124
+ }
125
+ NgtsLineInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsLineInput, deps: null, target: i0.ɵɵFactoryTarget.Directive });
126
+ NgtsLineInput.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.3", type: NgtsLineInput, inputs: { vertexColors: "vertexColors", lineWidth: "lineWidth", alphaToCoverage: "alphaToCoverage", color: "color", dashed: "dashed", dashScale: "dashScale", dashSize: "dashSize", dashOffset: "dashOffset", gapSize: "gapSize", resolution: "resolution", wireframe: "wireframe", worldUnits: "worldUnits" }, usesInheritance: true, ngImport: i0 });
127
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsLineInput, decorators: [{
128
+ type: Directive
129
+ }], propDecorators: { vertexColors: [{
130
+ type: Input
131
+ }], lineWidth: [{
132
+ type: Input
133
+ }], alphaToCoverage: [{
134
+ type: Input
135
+ }], color: [{
136
+ type: Input
137
+ }], dashed: [{
138
+ type: Input
139
+ }], dashScale: [{
140
+ type: Input
141
+ }], dashSize: [{
142
+ type: Input
143
+ }], dashOffset: [{
144
+ type: Input
145
+ }], gapSize: [{
146
+ type: Input
147
+ }], resolution: [{
148
+ type: Input
149
+ }], wireframe: [{
150
+ type: Input
151
+ }], worldUnits: [{
152
+ type: Input
153
+ }] } });
154
+
155
+ class NgtsLine extends NgtsLineInput {
156
+ constructor() {
157
+ super(...arguments);
158
+ this.Boolean = Boolean;
159
+ this.lineMaterial = new LineMaterial();
160
+ this.store = inject(NgtStore);
161
+ this.lineRef = injectNgtRef();
162
+ }
163
+ set points(points) {
164
+ this.set({ points });
165
+ }
166
+ set segments(segments) {
167
+ this.set({ segments });
168
+ }
169
+ // TODO: Figure out if this is the case for everything else.
170
+ // We'd want to run computeLineDistances on the Line2 on "points" changed
171
+ // Consequently,when "points" changes, LineGeometry also changes and that causes
172
+ // the Renderer to replace the LineGeometry on the Line2, which is what's happening.
173
+ // But the effect that runs line.computeLineDistances() runs a little BEFORE the new lineGeometry
174
+ // has been attached. So it doesn't work with the props changed from the Material
175
+ //
176
+ // Alternatively, we can also run the effect on line#children changes.
177
+ onAfterGeometryAttached({ parent }) {
178
+ // parent.computeLineDistances();
179
+ }
180
+ initialize() {
181
+ super.initialize();
182
+ this.set({ segments: false });
183
+ this.connect('lineGeometry', combineLatest([
184
+ this.select('points'),
185
+ this.select('segments'),
186
+ this.select('vertexColors').pipe(startWithUndefined()),
187
+ ]).pipe(map(([points, segments, vertexColors]) => {
188
+ const geometry = segments ? new LineSegmentsGeometry() : new LineGeometry();
189
+ const pValues = points.map((p) => {
190
+ const isArray = Array.isArray(p);
191
+ return p instanceof THREE.Vector3
192
+ ? [p.x, p.y, p.z]
193
+ : p instanceof THREE.Vector2
194
+ ? [p.x, p.y, 0]
195
+ : isArray && p.length === 3
196
+ ? [p[0], p[1], p[2]]
197
+ : isArray && p.length === 2
198
+ ? [p[0], p[1], 0]
199
+ : p;
200
+ });
201
+ geometry.setPositions(pValues.flat());
202
+ if (vertexColors) {
203
+ const cValues = vertexColors.map((c) => c instanceof THREE.Color ? c.toArray() : c);
204
+ geometry.setColors(cValues.flat());
205
+ }
206
+ return geometry;
207
+ })));
208
+ }
209
+ ngOnInit() {
210
+ this.connect('materialResolution', combineLatest([this.store.select('size'), this.select('resolution').pipe(startWithUndefined())]).pipe(map(([size, resolution]) => resolution ?? [size.width, size.height])));
211
+ if (!this.lineRef.nativeElement) {
212
+ this.lineRef.nativeElement = this.get('segments') ? new LineSegments2() : new Line2();
213
+ }
214
+ this.computeLineDistances();
215
+ this.disposeGeometry();
216
+ }
217
+ computeLineDistances() {
218
+ this.hold(combineLatest([this.lineRef.$, this.lineRef.children$('nonObjects'), this.select('points')]), ([line]) => {
219
+ line.computeLineDistances();
220
+ });
221
+ }
222
+ disposeGeometry() {
223
+ this.effect(this.select('lineGeometry'), (lineGeometry) => {
224
+ return () => lineGeometry.dispose();
225
+ });
226
+ }
227
+ }
228
+ NgtsLine.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsLine, deps: null, target: i0.ɵɵFactoryTarget.Component });
229
+ NgtsLine.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsLine, isStandalone: true, selector: "ngts-line[points]", inputs: { lineRef: "lineRef", points: "points", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
230
+ <ngt-primitive *args="[lineRef.nativeElement]" [ref]="lineRef" ngtCompound>
231
+ <ngt-primitive
232
+ *args="[get('lineGeometry')]"
233
+ attach="geometry"
234
+ (afterAttach)="onAfterGeometryAttached($any($event))"
235
+ />
236
+ <ngt-primitive
237
+ *args="[lineMaterial]"
238
+ attach="material"
239
+ [color]="get('color')"
240
+ [vertexColors]="Boolean(get('vertexColors'))"
241
+ [resolution]="get('materialResolution')"
242
+ [linewidth]="get('lineWidth')"
243
+ [alphaToCoverage]="get('alphaToCoverage')"
244
+ [dashed]="get('dashed')"
245
+ [dashScale]="get('dashScale') ?? lineMaterial.dashScale"
246
+ [dashSize]="get('dashSize') ?? lineMaterial.dashSize"
247
+ [dashOffset]="get('dashOffset') ?? lineMaterial.dashOffset"
248
+ [gapSize]="get('gapSize') ?? lineMaterial.gapSize"
249
+ [wireframe]="get('wireframe') ?? lineMaterial.wireframe"
250
+ [worldUnits]="get('worldUnits')"
251
+ />
252
+ </ngt-primitive>
253
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] });
254
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsLine, decorators: [{
255
+ type: Component,
256
+ args: [{
257
+ selector: 'ngts-line[points]',
258
+ standalone: true,
259
+ template: `
260
+ <ngt-primitive *args="[lineRef.nativeElement]" [ref]="lineRef" ngtCompound>
261
+ <ngt-primitive
262
+ *args="[get('lineGeometry')]"
263
+ attach="geometry"
264
+ (afterAttach)="onAfterGeometryAttached($any($event))"
265
+ />
266
+ <ngt-primitive
267
+ *args="[lineMaterial]"
268
+ attach="material"
269
+ [color]="get('color')"
270
+ [vertexColors]="Boolean(get('vertexColors'))"
271
+ [resolution]="get('materialResolution')"
272
+ [linewidth]="get('lineWidth')"
273
+ [alphaToCoverage]="get('alphaToCoverage')"
274
+ [dashed]="get('dashed')"
275
+ [dashScale]="get('dashScale') ?? lineMaterial.dashScale"
276
+ [dashSize]="get('dashSize') ?? lineMaterial.dashSize"
277
+ [dashOffset]="get('dashOffset') ?? lineMaterial.dashOffset"
278
+ [gapSize]="get('gapSize') ?? lineMaterial.gapSize"
279
+ [wireframe]="get('wireframe') ?? lineMaterial.wireframe"
280
+ [worldUnits]="get('worldUnits')"
281
+ />
282
+ </ngt-primitive>
283
+ `,
284
+ imports: [NgtArgs],
285
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
286
+ }]
287
+ }], propDecorators: { lineRef: [{
288
+ type: Input
289
+ }], points: [{
290
+ type: Input
291
+ }], segments: [{
292
+ type: Input
293
+ }] } });
294
+
295
+ class NgtsCatmullRomLine extends NgtsLineInput {
296
+ constructor() {
297
+ super(...arguments);
298
+ this.lineRef = injectNgtRef();
299
+ }
300
+ set points(points) {
301
+ this.set({ points });
302
+ }
303
+ set closed(closed) {
304
+ this.set({ closed });
305
+ }
306
+ set curveType(curveType) {
307
+ this.set({ curveType });
308
+ }
309
+ set tension(tension) {
310
+ this.set({ tension });
311
+ }
312
+ set segments(segments) {
313
+ this.set({ segments });
314
+ }
315
+ initialize() {
316
+ super.initialize();
317
+ this.set({ closed: false, curveType: 'centripetal', tension: 0.5, segments: 64 });
318
+ this.connect('curve', combineLatest([
319
+ this.select('points'),
320
+ this.select('closed'),
321
+ this.select('curveType'),
322
+ this.select('tension'),
323
+ ]).pipe(map(([points, closed, curveType, tension]) => {
324
+ const mappedPoints = points.map((p) => p instanceof THREE.Vector3 ? p : new THREE.Vector3(...p));
325
+ return new CatmullRomCurve3(mappedPoints, closed, curveType, tension);
326
+ })));
327
+ this.connect('segmentedPoints', combineLatest([this.select('curve'), this.select('segments')]).pipe(map(([curve, segments]) => curve.getPoints(segments))));
328
+ this.connect('interpolatedVertexColors', combineLatest([this.select('vertexColors').pipe(startWithUndefined()), this.select('segments')]).pipe(map(([vertexColors, segments]) => {
329
+ if (!vertexColors || vertexColors.length < 2)
330
+ return undefined;
331
+ if (vertexColors.length === segments + 1)
332
+ return vertexColors;
333
+ const mappedColors = vertexColors.map((color) => color instanceof THREE.Color ? color : new THREE.Color(...color));
334
+ if (this.get('closed'))
335
+ mappedColors.push(mappedColors[0].clone());
336
+ const iColors = [mappedColors[0]];
337
+ const divisions = segments / (mappedColors.length - 1);
338
+ for (let i = 0; i < segments; i++) {
339
+ const alpha = (i % divisions) / divisions;
340
+ const colorIndex = Math.floor(i / divisions);
341
+ iColors.push(mappedColors[colorIndex].clone().lerp(mappedColors[colorIndex + 1], alpha));
342
+ }
343
+ iColors.push(mappedColors[mappedColors.length - 1]);
344
+ })));
345
+ }
346
+ }
347
+ NgtsCatmullRomLine.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsCatmullRomLine, deps: null, target: i0.ɵɵFactoryTarget.Component });
348
+ NgtsCatmullRomLine.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsCatmullRomLine, isStandalone: true, selector: "ngts-catmull-rom-line[points]", inputs: { lineRef: "lineRef", points: "points", closed: "closed", curveType: "curveType", tension: "tension", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
349
+ <ngts-line
350
+ [lineRef]="lineRef"
351
+ [points]="get('segmentedPoints')"
352
+ [color]="get('color')"
353
+ [vertexColors]="get('interpolatedVertexColors')"
354
+ [resolution]="get('resolution')"
355
+ [lineWidth]="get('lineWidth')"
356
+ [alphaToCoverage]="get('alphaToCoverage')"
357
+ [dashed]="get('dashed')"
358
+ [dashScale]="get('dashScale')"
359
+ [dashOffset]="get('dashOffset')"
360
+ [dashSize]="get('dashSize')"
361
+ [gapSize]="get('gapSize')"
362
+ [wireframe]="get('wireframe')"
363
+ [worldUnits]="get('worldUnits')"
364
+ />
365
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line[points]", inputs: ["lineRef", "points", "segments"] }] });
366
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsCatmullRomLine, decorators: [{
367
+ type: Component,
368
+ args: [{
369
+ selector: 'ngts-catmull-rom-line[points]',
370
+ standalone: true,
371
+ template: `
372
+ <ngts-line
373
+ [lineRef]="lineRef"
374
+ [points]="get('segmentedPoints')"
375
+ [color]="get('color')"
376
+ [vertexColors]="get('interpolatedVertexColors')"
377
+ [resolution]="get('resolution')"
378
+ [lineWidth]="get('lineWidth')"
379
+ [alphaToCoverage]="get('alphaToCoverage')"
380
+ [dashed]="get('dashed')"
381
+ [dashScale]="get('dashScale')"
382
+ [dashOffset]="get('dashOffset')"
383
+ [dashSize]="get('dashSize')"
384
+ [gapSize]="get('gapSize')"
385
+ [wireframe]="get('wireframe')"
386
+ [worldUnits]="get('worldUnits')"
387
+ />
388
+ `,
389
+ imports: [NgtsLine],
390
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
391
+ }]
392
+ }], propDecorators: { lineRef: [{
393
+ type: Input
394
+ }], points: [{
395
+ type: Input
396
+ }], closed: [{
397
+ type: Input
398
+ }], curveType: [{
399
+ type: Input
400
+ }], tension: [{
401
+ type: Input
402
+ }], segments: [{
403
+ type: Input
404
+ }] } });
405
+
406
+ class NgtsCubicBezierLine extends NgtsLineInput {
407
+ constructor() {
408
+ super(...arguments);
409
+ this.lineRef = injectNgtRef();
410
+ }
411
+ set start(start) {
412
+ this.set({ start });
413
+ }
414
+ set end(end) {
415
+ this.set({ end });
416
+ }
417
+ set midA(midA) {
418
+ this.set({ midA });
419
+ }
420
+ set midB(midB) {
421
+ this.set({ midB });
422
+ }
423
+ set segments(segments) {
424
+ this.set({ segments });
425
+ }
426
+ initialize() {
427
+ super.initialize();
428
+ this.set({ segments: 10 });
429
+ this.connect('points', this.select(['start', 'end', 'midA', 'midB', 'segments'], ({ start, end, midA, midB, segments }) => {
430
+ const startV = start instanceof THREE.Vector3 ? start : new THREE.Vector3(...start);
431
+ const endV = end instanceof THREE.Vector3 ? end : new THREE.Vector3(...end);
432
+ const midAV = midA instanceof THREE.Vector3 ? midA : new THREE.Vector3(...midA);
433
+ const midBV = midB instanceof THREE.Vector3 ? midB : new THREE.Vector3(...midB);
434
+ return new THREE.CubicBezierCurve3(startV, midAV, midBV, endV).getPoints(segments);
435
+ }));
436
+ }
437
+ }
438
+ NgtsCubicBezierLine.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsCubicBezierLine, deps: null, target: i0.ɵɵFactoryTarget.Component });
439
+ NgtsCubicBezierLine.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsCubicBezierLine, isStandalone: true, selector: "ngts-cubic-bezier-line[start][end][midA][midB]", inputs: { lineRef: "lineRef", start: "start", end: "end", midA: "midA", midB: "midB", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
440
+ <ngts-line
441
+ [lineRef]="lineRef"
442
+ [points]="get('points')"
443
+ [color]="get('color')"
444
+ [vertexColors]="get('vertexColors')"
445
+ [resolution]="get('resolution')"
446
+ [lineWidth]="get('lineWidth')"
447
+ [alphaToCoverage]="get('alphaToCoverage')"
448
+ [dashed]="get('dashed')"
449
+ [dashScale]="get('dashScale')"
450
+ [dashSize]="get('dashSize')"
451
+ [dashOffset]="get('dashOffset')"
452
+ [gapSize]="get('gapSize')"
453
+ [wireframe]="get('wireframe')"
454
+ [worldUnits]="get('worldUnits')"
455
+ />
456
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line[points]", inputs: ["lineRef", "points", "segments"] }] });
457
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsCubicBezierLine, decorators: [{
458
+ type: Component,
459
+ args: [{
460
+ selector: 'ngts-cubic-bezier-line[start][end][midA][midB]',
461
+ standalone: true,
462
+ template: `
463
+ <ngts-line
464
+ [lineRef]="lineRef"
465
+ [points]="get('points')"
466
+ [color]="get('color')"
467
+ [vertexColors]="get('vertexColors')"
468
+ [resolution]="get('resolution')"
469
+ [lineWidth]="get('lineWidth')"
470
+ [alphaToCoverage]="get('alphaToCoverage')"
471
+ [dashed]="get('dashed')"
472
+ [dashScale]="get('dashScale')"
473
+ [dashSize]="get('dashSize')"
474
+ [dashOffset]="get('dashOffset')"
475
+ [gapSize]="get('gapSize')"
476
+ [wireframe]="get('wireframe')"
477
+ [worldUnits]="get('worldUnits')"
478
+ />
479
+ `,
480
+ imports: [NgtsLine, NgIf],
481
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
482
+ }]
483
+ }], propDecorators: { lineRef: [{
484
+ type: Input
485
+ }], start: [{
486
+ type: Input
487
+ }], end: [{
488
+ type: Input
489
+ }], midA: [{
490
+ type: Input
491
+ }], midB: [{
492
+ type: Input
493
+ }], segments: [{
494
+ type: Input
495
+ }] } });
496
+
497
+ const isOrbitControls = (controls) => {
498
+ return 'minPolarAngle' in controls;
499
+ };
500
+ const NGTS_GIZMO_HELPER_API = new InjectionToken('NgtsGizmoHelper API');
501
+ function gizmoHelperApiFactory(gizmo) {
502
+ const store = inject(NgtStore);
503
+ return {
504
+ tweenCamera: (direction) => {
505
+ const { controls, camera, invalidate } = store.get();
506
+ const defaultControls = controls;
507
+ gizmo.animating = true;
508
+ if (defaultControls)
509
+ gizmo.focusPoint = defaultControls.target;
510
+ gizmo.radius = camera.position.distanceTo(gizmo.target);
511
+ // rotate from current camera orientation
512
+ gizmo.q1.copy(camera.quaternion);
513
+ // to new current camera orientation
514
+ gizmo.targetPosition.copy(direction).multiplyScalar(gizmo.radius).add(gizmo.target);
515
+ gizmo.dummy.lookAt(gizmo.targetPosition);
516
+ gizmo.q2.copy(gizmo.dummy.quaternion);
517
+ invalidate();
518
+ },
519
+ };
520
+ }
521
+ extend({ Group });
522
+ class NgtsGizmoHelperContent {
523
+ }
524
+ NgtsGizmoHelperContent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoHelperContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
525
+ NgtsGizmoHelperContent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.3", type: NgtsGizmoHelperContent, isStandalone: true, selector: "ng-template[ngtsGizmoHelperContent]", ngImport: i0 });
526
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoHelperContent, decorators: [{
527
+ type: Directive,
528
+ args: [{
529
+ selector: 'ng-template[ngtsGizmoHelperContent]',
530
+ standalone: true,
531
+ }]
532
+ }] });
533
+ class NgtsGizmoHelper extends NgtRxStore {
534
+ constructor() {
535
+ super(...arguments);
536
+ this.store = inject(NgtStore);
537
+ this.gizmoRef = injectNgtRef();
538
+ this.virtualCameraRef = injectNgtRef();
539
+ this.animating = false;
540
+ this.radius = 0;
541
+ this.focusPoint = new Vector3(0, 0, 0);
542
+ this.q1 = new Quaternion();
543
+ this.q2 = new Quaternion();
544
+ this.target = new Vector3();
545
+ this.targetPosition = new Vector3();
546
+ this.dummy = new Object3D();
547
+ this.defaultUp = new Vector3(0, 0, 0);
548
+ this.turnRate = 2 * Math.PI; // turn rate in angles per sec
549
+ this.matrix = new Matrix4();
550
+ this.updated = new EventEmitter();
551
+ }
552
+ set alignment(alignment) {
553
+ this.set({ alignment });
554
+ }
555
+ set margin(margin) {
556
+ this.set({ margin });
557
+ }
558
+ set renderPriority(renderPriority) {
559
+ this.set({ renderPriority });
560
+ }
561
+ set autoClear(autoClear) {
562
+ this.set({ autoClear });
563
+ }
564
+ initialize() {
565
+ super.initialize();
566
+ this.set({ alignment: 'bottom-right', margin: [80, 80], renderPriority: 1 });
567
+ }
568
+ ngOnInit() {
569
+ this.updateDefaultUp();
570
+ this.setGizmoPosition();
571
+ }
572
+ onBeforeRender(delta) {
573
+ if (this.virtualCameraRef.nativeElement && this.gizmoRef.nativeElement) {
574
+ const { controls, camera: mainCamera, invalidate } = this.store.get();
575
+ const defaultControls = controls;
576
+ // Animate step
577
+ if (this.animating) {
578
+ if (this.q1.angleTo(this.q2) < 0.01) {
579
+ this.animating = false;
580
+ // Orbit controls uses UP vector as the orbit axes,
581
+ // so we need to reset it after the animation is done
582
+ // moving it around for the controls to work correctly
583
+ if (isOrbitControls(defaultControls)) {
584
+ mainCamera.up.copy(this.defaultUp);
585
+ }
586
+ }
587
+ else {
588
+ const step = delta * this.turnRate;
589
+ // animate position by doing a slerp and then scaling the position on the unit sphere
590
+ this.q1.rotateTowards(this.q2, step);
591
+ // animate orientation
592
+ mainCamera.position
593
+ .set(0, 0, 1)
594
+ .applyQuaternion(this.q1)
595
+ .multiplyScalar(this.radius)
596
+ .add(this.focusPoint);
597
+ mainCamera.up.set(0, 1, 0).applyQuaternion(this.q1).normalize();
598
+ mainCamera.quaternion.copy(this.q1);
599
+ if (this.updated.observed)
600
+ this.updated.emit();
601
+ else if (defaultControls) {
602
+ defaultControls.update();
603
+ }
604
+ invalidate();
605
+ }
606
+ }
607
+ // Sync Gizmo with main camera orientation
608
+ this.matrix.copy(mainCamera.matrix).invert();
609
+ this.gizmoRef.nativeElement.quaternion.setFromRotationMatrix(this.matrix);
610
+ }
611
+ }
612
+ setGizmoPosition() {
613
+ this.connect('gizmoPosition', combineLatest([this.store.select('size'), this.select(selectSlice(['alignment', 'margin']))]).pipe(map(([size, { alignment, margin }]) => {
614
+ const [marginX, marginY] = margin;
615
+ const x = alignment.endsWith('-center')
616
+ ? 0
617
+ : alignment.endsWith('-left')
618
+ ? -size.width / 2 + marginX
619
+ : size.width / 2 - marginX;
620
+ const y = alignment.startsWith('center-')
621
+ ? 0
622
+ : alignment.startsWith('top-')
623
+ ? size.height / 2 - marginY
624
+ : -size.height / 2 + marginY;
625
+ return [x, y, 0];
626
+ })));
627
+ }
628
+ updateDefaultUp() {
629
+ this.hold(this.store.select('camera'), (camera) => {
630
+ this.defaultUp.copy(camera.up);
631
+ });
632
+ }
633
+ }
634
+ NgtsGizmoHelper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoHelper, deps: null, target: i0.ɵɵFactoryTarget.Component });
635
+ NgtsGizmoHelper.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsGizmoHelper, isStandalone: true, selector: "ngts-gizmo-helper", inputs: { alignment: "alignment", margin: "margin", renderPriority: "renderPriority", autoClear: "autoClear" }, outputs: { updated: "updated" }, providers: [{ provide: NGTS_GIZMO_HELPER_API, useFactory: gizmoHelperApiFactory, deps: [NgtsGizmoHelper] }], queries: [{ propertyName: "gizmoHelperContent", first: true, predicate: NgtsGizmoHelperContent, descendants: true, read: TemplateRef, static: true }], usesInheritance: true, ngImport: i0, template: `
636
+ <ngt-portal [renderPriority]="get('renderPriority')">
637
+ <ng-template ngtPortalContent>
638
+ <ngts-orthographic-camera
639
+ [cameraRef]="virtualCameraRef"
640
+ [makeDefault]="true"
641
+ [position]="[0, 0, 200]"
642
+ />
643
+ <ngt-group
644
+ [ref]="gizmoRef"
645
+ [position]="get('gizmoPosition')"
646
+ (beforeRender)="onBeforeRender($any($event).state.delta)"
647
+ >
648
+ <ng-container *ngTemplateOutlet="gizmoHelperContent" />
649
+ </ngt-group>
650
+ </ng-template>
651
+ </ngt-portal>
652
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtPortal, selector: "ngt-portal", inputs: ["container", "state", "autoRender", "autoRenderPriority"], outputs: ["beforeRender"] }, { kind: "directive", type: NgtPortalContent, selector: "ng-template[ngtPortalContent]" }, { kind: "component", type: NgtsOrthographicCamera, selector: "ngts-orthographic-camera", inputs: ["left", "right", "top", "bottom"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
653
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoHelper, decorators: [{
654
+ type: Component,
655
+ args: [{
656
+ selector: 'ngts-gizmo-helper',
657
+ standalone: true,
658
+ template: `
659
+ <ngt-portal [renderPriority]="get('renderPriority')">
660
+ <ng-template ngtPortalContent>
661
+ <ngts-orthographic-camera
662
+ [cameraRef]="virtualCameraRef"
663
+ [makeDefault]="true"
664
+ [position]="[0, 0, 200]"
665
+ />
666
+ <ngt-group
667
+ [ref]="gizmoRef"
668
+ [position]="get('gizmoPosition')"
669
+ (beforeRender)="onBeforeRender($any($event).state.delta)"
670
+ >
671
+ <ng-container *ngTemplateOutlet="gizmoHelperContent" />
672
+ </ngt-group>
673
+ </ng-template>
674
+ </ngt-portal>
675
+ `,
676
+ imports: [NgtPortal, NgtPortalContent, NgtsOrthographicCamera, NgTemplateOutlet],
677
+ providers: [{ provide: NGTS_GIZMO_HELPER_API, useFactory: gizmoHelperApiFactory, deps: [NgtsGizmoHelper] }],
678
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
679
+ }]
680
+ }], propDecorators: { alignment: [{
681
+ type: Input
682
+ }], margin: [{
683
+ type: Input
684
+ }], renderPriority: [{
685
+ type: Input
686
+ }], autoClear: [{
687
+ type: Input
688
+ }], updated: [{
689
+ type: Output
690
+ }], gizmoHelperContent: [{
691
+ type: ContentChild,
692
+ args: [NgtsGizmoHelperContent, { static: true, read: TemplateRef }]
693
+ }] } });
694
+
695
+ const colors = { bg: '#f0f0f0', hover: '#999', text: 'black', stroke: 'black' };
696
+ const defaultFaces = ['Right', 'Left', 'Top', 'Bottom', 'Front', 'Back'];
697
+ const makePositionVector = (xyz) => new THREE.Vector3(...xyz).multiplyScalar(0.38);
698
+ const corners = [
699
+ [1, 1, 1],
700
+ [1, 1, -1],
701
+ [1, -1, 1],
702
+ [1, -1, -1],
703
+ [-1, 1, 1],
704
+ [-1, 1, -1],
705
+ [-1, -1, 1],
706
+ [-1, -1, -1],
707
+ ].map(makePositionVector);
708
+ const cornerDimensions = [0.25, 0.25, 0.25];
709
+ const edges = [
710
+ [1, 1, 0],
711
+ [1, 0, 1],
712
+ [1, 0, -1],
713
+ [1, -1, 0],
714
+ [0, 1, 1],
715
+ [0, 1, -1],
716
+ [0, -1, 1],
717
+ [0, -1, -1],
718
+ [-1, 1, 0],
719
+ [-1, 0, 1],
720
+ [-1, 0, -1],
721
+ [-1, -1, 0],
722
+ ].map(makePositionVector);
723
+ const edgeDimensions = edges.map((edge) => edge.toArray().map((axis) => (axis == 0 ? 0.5 : 0.25)));
724
+
725
+ class NgtsGizmoViewcubeInputs extends NgtRxStore {
726
+ constructor() {
727
+ super(...arguments);
728
+ this.store = inject(NgtStore);
729
+ }
730
+ set opacity(opacity) {
731
+ this.set({ opacity });
732
+ }
733
+ set hoverColor(hoverColor) {
734
+ this.set({ hoverColor });
735
+ }
736
+ set textColor(textColor) {
737
+ this.set({ textColor });
738
+ }
739
+ set strokeColor(strokeColor) {
740
+ this.set({ strokeColor });
741
+ }
742
+ set faces(faces) {
743
+ this.set({ faces });
744
+ }
745
+ set clickEmitter(clickEmitter) {
746
+ this.set({ clickEmitter });
747
+ }
748
+ }
749
+ NgtsGizmoViewcubeInputs.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewcubeInputs, deps: null, target: i0.ɵɵFactoryTarget.Directive });
750
+ NgtsGizmoViewcubeInputs.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.3", type: NgtsGizmoViewcubeInputs, inputs: { opacity: "opacity", hoverColor: "hoverColor", textColor: "textColor", strokeColor: "strokeColor", faces: "faces", clickEmitter: "clickEmitter" }, usesInheritance: true, ngImport: i0 });
751
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewcubeInputs, decorators: [{
752
+ type: Directive
753
+ }], propDecorators: { opacity: [{
754
+ type: Input
755
+ }], hoverColor: [{
756
+ type: Input
757
+ }], textColor: [{
758
+ type: Input
759
+ }], strokeColor: [{
760
+ type: Input
761
+ }], faces: [{
762
+ type: Input
763
+ }], clickEmitter: [{
764
+ type: Input
765
+ }] } });
766
+
767
+ extend({ Mesh, BoxGeometry, MeshBasicMaterial });
768
+ class NgtsGizmoViewcubeEdgeCube extends NgtsGizmoViewcubeInputs {
769
+ constructor() {
770
+ super(...arguments);
771
+ this.gizmoHelperApi = inject(NGTS_GIZMO_HELPER_API);
772
+ this.hover = false;
773
+ }
774
+ set dimensions(dimensions) {
775
+ this.set({ dimensions });
776
+ }
777
+ set position(position) {
778
+ this.set({ position });
779
+ }
780
+ initialize() {
781
+ super.initialize();
782
+ this.set({ hoverColor: colors.hover });
783
+ }
784
+ onPointerMove(event) {
785
+ event.stopPropagation();
786
+ this.hover = true;
787
+ }
788
+ onPointerOut(event) {
789
+ event.stopPropagation();
790
+ this.hover = false;
791
+ }
792
+ onClick(event) {
793
+ if (this.get('clickEmitter')?.observed) {
794
+ this.get('clickEmitter').emit(event);
795
+ }
796
+ else {
797
+ event.stopPropagation();
798
+ this.gizmoHelperApi.tweenCamera(this.get('position'));
799
+ }
800
+ }
801
+ }
802
+ NgtsGizmoViewcubeEdgeCube.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewcubeEdgeCube, deps: null, target: i0.ɵɵFactoryTarget.Component });
803
+ NgtsGizmoViewcubeEdgeCube.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsGizmoViewcubeEdgeCube, isStandalone: true, selector: "ngts-gizmo-viewcube-edge-cube[dimensions][position]", inputs: { dimensions: "dimensions", position: "position" }, usesInheritance: true, ngImport: i0, template: `
804
+ <ngt-mesh
805
+ [scale]="1.01"
806
+ [position]="get('position')"
807
+ (pointermove)="onPointerMove($any($event))"
808
+ (pointerout)="onPointerOut($any($event))"
809
+ (click)="onClick($any($event))"
810
+ >
811
+ <ngt-box-geometry *args="get('dimensions')" />
812
+ <ngt-mesh-basic-material
813
+ [color]="hover ? get('hoverColor') : 'white'"
814
+ [transparent]="true"
815
+ [opacity]="0.6"
816
+ [visible]="hover"
817
+ />
818
+ </ngt-mesh>
819
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] });
820
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewcubeEdgeCube, decorators: [{
821
+ type: Component,
822
+ args: [{
823
+ selector: 'ngts-gizmo-viewcube-edge-cube[dimensions][position]',
824
+ standalone: true,
825
+ template: `
826
+ <ngt-mesh
827
+ [scale]="1.01"
828
+ [position]="get('position')"
829
+ (pointermove)="onPointerMove($any($event))"
830
+ (pointerout)="onPointerOut($any($event))"
831
+ (click)="onClick($any($event))"
832
+ >
833
+ <ngt-box-geometry *args="get('dimensions')" />
834
+ <ngt-mesh-basic-material
835
+ [color]="hover ? get('hoverColor') : 'white'"
836
+ [transparent]="true"
837
+ [opacity]="0.6"
838
+ [visible]="hover"
839
+ />
840
+ </ngt-mesh>
841
+ `,
842
+ imports: [NgtArgs],
843
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
844
+ }]
845
+ }], propDecorators: { dimensions: [{
846
+ type: Input
847
+ }], position: [{
848
+ type: Input
849
+ }] } });
850
+
851
+ extend({ MeshLambertMaterial, Mesh, BoxGeometry });
852
+ class NgtsGizmoViewcubeFaceMaterial extends NgtsGizmoViewcubeInputs {
853
+ constructor() {
854
+ super(...arguments);
855
+ this.document = inject(DOCUMENT);
856
+ }
857
+ set index(index) {
858
+ this.set({ index });
859
+ }
860
+ set hover(hover) {
861
+ this.set({ hover });
862
+ }
863
+ set font(font) {
864
+ this.set({ font });
865
+ }
866
+ set color(color) {
867
+ this.set({ color });
868
+ }
869
+ initialize() {
870
+ super.initialize();
871
+ this.set({
872
+ font: '20px Inter var, Arial, sans-serif',
873
+ faces: defaultFaces,
874
+ color: colors.bg,
875
+ hoverColor: colors.hover,
876
+ textColor: colors.text,
877
+ strokeColor: colors.stroke,
878
+ opacity: 1,
879
+ });
880
+ this.connect('texture', this.select(['index', 'faces', 'color', 'font', 'textColor', 'strokeColor'], ({ index, faces, color, font, textColor, strokeColor }) => {
881
+ const canvas = this.document.createElement('canvas');
882
+ canvas.width = 128;
883
+ canvas.height = 128;
884
+ const context = canvas.getContext('2d');
885
+ context.fillStyle = color;
886
+ context.fillRect(0, 0, canvas.width, canvas.height);
887
+ context.strokeStyle = strokeColor;
888
+ context.strokeRect(0, 0, canvas.width, canvas.height);
889
+ context.font = font;
890
+ context.textAlign = 'center';
891
+ context.fillStyle = textColor;
892
+ context.fillText(faces[index].toUpperCase(), 64, 76);
893
+ return new CanvasTexture(canvas);
894
+ }));
895
+ }
896
+ }
897
+ NgtsGizmoViewcubeFaceMaterial.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewcubeFaceMaterial, deps: null, target: i0.ɵɵFactoryTarget.Component });
898
+ NgtsGizmoViewcubeFaceMaterial.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsGizmoViewcubeFaceMaterial, isStandalone: true, selector: "ngts-gizmo-viewcube-face-material[hover][index]", inputs: { index: "index", hover: "hover", font: "font", color: "color" }, usesInheritance: true, ngImport: i0, template: `
899
+ <ngt-mesh-lambert-material
900
+ [attach]="['material', get('index')]"
901
+ [map]="get('texture')"
902
+ [color]="get('hover') ? get('hoverColor') : get('color')"
903
+ [opacity]="get('opacity')"
904
+ [transparent]="true"
905
+ >
906
+ <ngt-value [rawValue]="store.get('gl').outputEncoding" attach="map.encoding" />
907
+ <ngt-value [rawValue]="store.get('gl').capabilities.getMaxAnisotropy() || 1" attach="map.anisotrophy" />
908
+ </ngt-mesh-lambert-material>
909
+ `, isInline: true });
910
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewcubeFaceMaterial, decorators: [{
911
+ type: Component,
912
+ args: [{
913
+ selector: 'ngts-gizmo-viewcube-face-material[hover][index]',
914
+ standalone: true,
915
+ template: `
916
+ <ngt-mesh-lambert-material
917
+ [attach]="['material', get('index')]"
918
+ [map]="get('texture')"
919
+ [color]="get('hover') ? get('hoverColor') : get('color')"
920
+ [opacity]="get('opacity')"
921
+ [transparent]="true"
922
+ >
923
+ <ngt-value [rawValue]="store.get('gl').outputEncoding" attach="map.encoding" />
924
+ <ngt-value [rawValue]="store.get('gl').capabilities.getMaxAnisotropy() || 1" attach="map.anisotrophy" />
925
+ </ngt-mesh-lambert-material>
926
+ `,
927
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
928
+ }]
929
+ }], propDecorators: { index: [{
930
+ type: Input
931
+ }], hover: [{
932
+ type: Input
933
+ }], font: [{
934
+ type: Input
935
+ }], color: [{
936
+ type: Input
937
+ }] } });
938
+ class NgtsGizmoViewcubeFaceCube extends NgtsGizmoViewcubeInputs {
939
+ constructor() {
940
+ super(...arguments);
941
+ this.gizmoHelperApi = inject(NGTS_GIZMO_HELPER_API);
942
+ this.hover = -1;
943
+ }
944
+ set font(font) {
945
+ this.set({ font });
946
+ }
947
+ set color(color) {
948
+ this.set({ color });
949
+ }
950
+ onPointerMove(event) {
951
+ event.stopPropagation();
952
+ this.hover = Math.floor(event.faceIndex / 2);
953
+ }
954
+ onPointerOut(event) {
955
+ event.stopPropagation();
956
+ this.hover = -1;
957
+ }
958
+ onClick(event) {
959
+ if (this.get('clickEmitter')?.observed) {
960
+ this.get('clickEmitter').emit(event);
961
+ }
962
+ else {
963
+ event.stopPropagation();
964
+ this.gizmoHelperApi.tweenCamera(event.face.normal);
965
+ }
966
+ }
967
+ }
968
+ NgtsGizmoViewcubeFaceCube.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewcubeFaceCube, deps: null, target: i0.ɵɵFactoryTarget.Component });
969
+ NgtsGizmoViewcubeFaceCube.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsGizmoViewcubeFaceCube, isStandalone: true, selector: "ngts-gizmo-viewcube-face-cube", inputs: { font: "font", color: "color" }, usesInheritance: true, ngImport: i0, template: `
970
+ <ngt-mesh
971
+ (pointermove)="onPointerMove($any($event))"
972
+ (pointerout)="onPointerOut($any($event))"
973
+ (click)="onClick($any($event))"
974
+ >
975
+ <ngt-box-geometry />
976
+ <ngts-gizmo-viewcube-face-material
977
+ *ngFor="let i; repeat: 6"
978
+ [hover]="hover === i"
979
+ [index]="i"
980
+ [font]="get('font')"
981
+ [color]="get('color')"
982
+ [opacity]="get('opacity')"
983
+ [hoverColor]="get('hoverColor')"
984
+ [textColor]="get('textColor')"
985
+ [strokeColor]="get('strokeColor')"
986
+ [faces]="get('faces')"
987
+ />
988
+ </ngt-mesh>
989
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsGizmoViewcubeFaceMaterial, selector: "ngts-gizmo-viewcube-face-material[hover][index]", inputs: ["index", "hover", "font", "color"] }, { kind: "directive", type: NgtRepeat, selector: "[ngFor][ngForRepeat]", inputs: ["ngForRepeat"] }] });
990
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewcubeFaceCube, decorators: [{
991
+ type: Component,
992
+ args: [{
993
+ selector: 'ngts-gizmo-viewcube-face-cube',
994
+ standalone: true,
995
+ template: `
996
+ <ngt-mesh
997
+ (pointermove)="onPointerMove($any($event))"
998
+ (pointerout)="onPointerOut($any($event))"
999
+ (click)="onClick($any($event))"
1000
+ >
1001
+ <ngt-box-geometry />
1002
+ <ngts-gizmo-viewcube-face-material
1003
+ *ngFor="let i; repeat: 6"
1004
+ [hover]="hover === i"
1005
+ [index]="i"
1006
+ [font]="get('font')"
1007
+ [color]="get('color')"
1008
+ [opacity]="get('opacity')"
1009
+ [hoverColor]="get('hoverColor')"
1010
+ [textColor]="get('textColor')"
1011
+ [strokeColor]="get('strokeColor')"
1012
+ [faces]="get('faces')"
1013
+ />
1014
+ </ngt-mesh>
1015
+ `,
1016
+ imports: [NgtsGizmoViewcubeFaceMaterial, NgtRepeat],
1017
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1018
+ }]
1019
+ }], propDecorators: { font: [{
1020
+ type: Input
1021
+ }], color: [{
1022
+ type: Input
1023
+ }] } });
1024
+
1025
+ extend({ Group, AmbientLight, PointLight });
1026
+ class NgtsGizmoViewcube extends NgtsGizmoViewcubeInputs {
1027
+ constructor() {
1028
+ super(...arguments);
1029
+ this.edges = edges;
1030
+ this.edgeDimensions = edgeDimensions;
1031
+ this.corners = corners;
1032
+ this.cornerDimensions = cornerDimensions;
1033
+ this.clicked = new EventEmitter();
1034
+ }
1035
+ set font(font) {
1036
+ this.set({ font });
1037
+ }
1038
+ set color(color) {
1039
+ this.set({ color });
1040
+ }
1041
+ }
1042
+ NgtsGizmoViewcube.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewcube, deps: null, target: i0.ɵɵFactoryTarget.Component });
1043
+ NgtsGizmoViewcube.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsGizmoViewcube, isStandalone: true, selector: "ngts-gizmo-viewcube", inputs: { font: "font", color: "color" }, outputs: { clicked: "clicked" }, usesInheritance: true, ngImport: i0, template: `
1044
+ <ngt-group [scale]="60">
1045
+ <ngts-gizmo-viewcube-face-cube
1046
+ [font]="get('font')"
1047
+ [color]="get('color')"
1048
+ [opacity]="get('opacity')"
1049
+ [hoverColor]="get('hoverColor')"
1050
+ [textColor]="get('textColor')"
1051
+ [strokeColor]="get('strokeColor')"
1052
+ [faces]="get('faces')"
1053
+ [clickEmitter]="clicked"
1054
+ />
1055
+
1056
+ <ngts-gizmo-viewcube-edge-cube
1057
+ *ngFor="let edge of edges; let i = index"
1058
+ [position]="edge"
1059
+ [dimensions]="edgeDimensions[i]"
1060
+ [font]="get('font')"
1061
+ [color]="get('color')"
1062
+ [opacity]="get('opacity')"
1063
+ [hoverColor]="get('hoverColor')"
1064
+ [textColor]="get('textColor')"
1065
+ [strokeColor]="get('strokeColor')"
1066
+ [faces]="get('faces')"
1067
+ [clickEmitter]="clicked"
1068
+ />
1069
+
1070
+ <ngts-gizmo-viewcube-edge-cube
1071
+ *ngFor="let corner of corners"
1072
+ [position]="corner"
1073
+ [dimensions]="cornerDimensions"
1074
+ [font]="get('font')"
1075
+ [color]="get('color')"
1076
+ [opacity]="get('opacity')"
1077
+ [hoverColor]="get('hoverColor')"
1078
+ [textColor]="get('textColor')"
1079
+ [strokeColor]="get('strokeColor')"
1080
+ [faces]="get('faces')"
1081
+ [clickEmitter]="clicked"
1082
+ />
1083
+
1084
+ <ngt-ambient-light [intensity]="0.5" />
1085
+ <ngt-point-light [position]="10" [intensity]="0.5" />
1086
+ </ngt-group>
1087
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsGizmoViewcubeEdgeCube, selector: "ngts-gizmo-viewcube-edge-cube[dimensions][position]", inputs: ["dimensions", "position"] }, { kind: "component", type: NgtsGizmoViewcubeFaceCube, selector: "ngts-gizmo-viewcube-face-cube", inputs: ["font", "color"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
1088
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewcube, decorators: [{
1089
+ type: Component,
1090
+ args: [{
1091
+ selector: 'ngts-gizmo-viewcube',
1092
+ standalone: true,
1093
+ template: `
1094
+ <ngt-group [scale]="60">
1095
+ <ngts-gizmo-viewcube-face-cube
1096
+ [font]="get('font')"
1097
+ [color]="get('color')"
1098
+ [opacity]="get('opacity')"
1099
+ [hoverColor]="get('hoverColor')"
1100
+ [textColor]="get('textColor')"
1101
+ [strokeColor]="get('strokeColor')"
1102
+ [faces]="get('faces')"
1103
+ [clickEmitter]="clicked"
1104
+ />
1105
+
1106
+ <ngts-gizmo-viewcube-edge-cube
1107
+ *ngFor="let edge of edges; let i = index"
1108
+ [position]="edge"
1109
+ [dimensions]="edgeDimensions[i]"
1110
+ [font]="get('font')"
1111
+ [color]="get('color')"
1112
+ [opacity]="get('opacity')"
1113
+ [hoverColor]="get('hoverColor')"
1114
+ [textColor]="get('textColor')"
1115
+ [strokeColor]="get('strokeColor')"
1116
+ [faces]="get('faces')"
1117
+ [clickEmitter]="clicked"
1118
+ />
1119
+
1120
+ <ngts-gizmo-viewcube-edge-cube
1121
+ *ngFor="let corner of corners"
1122
+ [position]="corner"
1123
+ [dimensions]="cornerDimensions"
1124
+ [font]="get('font')"
1125
+ [color]="get('color')"
1126
+ [opacity]="get('opacity')"
1127
+ [hoverColor]="get('hoverColor')"
1128
+ [textColor]="get('textColor')"
1129
+ [strokeColor]="get('strokeColor')"
1130
+ [faces]="get('faces')"
1131
+ [clickEmitter]="clicked"
1132
+ />
1133
+
1134
+ <ngt-ambient-light [intensity]="0.5" />
1135
+ <ngt-point-light [position]="10" [intensity]="0.5" />
1136
+ </ngt-group>
1137
+ `,
1138
+ imports: [NgtsGizmoViewcubeEdgeCube, NgtsGizmoViewcubeFaceCube, NgFor],
1139
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1140
+ }]
1141
+ }], propDecorators: { font: [{
1142
+ type: Input
1143
+ }], color: [{
1144
+ type: Input
1145
+ }], clicked: [{
1146
+ type: Output
1147
+ }] } });
1148
+
1149
+ extend({ Group, Mesh, BoxGeometry, MeshBasicMaterial, Sprite, SpriteMaterial });
1150
+ class NgtsGizmoViewportAxis extends NgtRxStore {
1151
+ set color(color) {
1152
+ this.set({ color });
1153
+ }
1154
+ set rotation(rotation) {
1155
+ this.set({ rotation });
1156
+ }
1157
+ set scale(scale) {
1158
+ this.set({ scale: scale === undefined ? this.get('scale') : scale });
1159
+ }
1160
+ initialize() {
1161
+ super.initialize();
1162
+ this.set({ scale: [0.8, 0.05, 0.05] });
1163
+ }
1164
+ }
1165
+ NgtsGizmoViewportAxis.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewportAxis, deps: null, target: i0.ɵɵFactoryTarget.Component });
1166
+ NgtsGizmoViewportAxis.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsGizmoViewportAxis, isStandalone: true, selector: "ngts-gizmo-viewport-axis[color][rotation]", inputs: { color: "color", rotation: "rotation", scale: "scale" }, usesInheritance: true, ngImport: i0, template: `
1167
+ <ngt-group [rotation]="get('rotation')">
1168
+ <ngt-mesh [position]="[0.4, 0, 0]">
1169
+ <ngt-box-geometry *args="get('scale')" />
1170
+ <ngt-mesh-basic-material [color]="get('color')" [toneMapped]="false" />
1171
+ </ngt-mesh>
1172
+ </ngt-group>
1173
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] });
1174
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewportAxis, decorators: [{
1175
+ type: Component,
1176
+ args: [{
1177
+ selector: 'ngts-gizmo-viewport-axis[color][rotation]',
1178
+ standalone: true,
1179
+ template: `
1180
+ <ngt-group [rotation]="get('rotation')">
1181
+ <ngt-mesh [position]="[0.4, 0, 0]">
1182
+ <ngt-box-geometry *args="get('scale')" />
1183
+ <ngt-mesh-basic-material [color]="get('color')" [toneMapped]="false" />
1184
+ </ngt-mesh>
1185
+ </ngt-group>
1186
+ `,
1187
+ imports: [NgtArgs],
1188
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1189
+ }]
1190
+ }], propDecorators: { color: [{
1191
+ type: Input
1192
+ }], rotation: [{
1193
+ type: Input
1194
+ }], scale: [{
1195
+ type: Input
1196
+ }] } });
1197
+ class NgtsGizmoViewportAxisHead extends NgtRxStore {
1198
+ constructor() {
1199
+ super(...arguments);
1200
+ this.document = inject(DOCUMENT);
1201
+ this.store = inject(NgtStore);
1202
+ this.gl = this.store.get('gl');
1203
+ }
1204
+ set arcStyle(arcStyle) {
1205
+ this.set({ arcStyle });
1206
+ }
1207
+ set label(label) {
1208
+ this.set({ label });
1209
+ }
1210
+ set labelColor(labelColor) {
1211
+ this.set({ labelColor });
1212
+ }
1213
+ set axisHeadScale(axisHeadScale) {
1214
+ this.set({ axisHeadScale });
1215
+ }
1216
+ set disabled(disabled) {
1217
+ this.set({ disabled });
1218
+ }
1219
+ set font(font) {
1220
+ this.set({ font });
1221
+ }
1222
+ set clickEmitter(clickEmitter) {
1223
+ this.set({ clickEmitter });
1224
+ }
1225
+ initialize() {
1226
+ super.initialize();
1227
+ this.set({ axisHeadScale: 1, active: false });
1228
+ this.connect('texture', combineLatest([
1229
+ this.select('arcStyle'),
1230
+ this.select('labelColor'),
1231
+ this.select('font'),
1232
+ this.select('label').pipe(startWithUndefined()),
1233
+ ]).pipe(map(([arcStyle, labelColor, font, label]) => {
1234
+ const canvas = this.document.createElement('canvas');
1235
+ canvas.width = 64;
1236
+ canvas.height = 64;
1237
+ const context = canvas.getContext('2d');
1238
+ context.beginPath();
1239
+ context.arc(32, 32, 16, 0, 2 * Math.PI);
1240
+ context.closePath();
1241
+ context.fillStyle = arcStyle;
1242
+ context.fill();
1243
+ if (label) {
1244
+ context.font = font;
1245
+ context.textAlign = 'center';
1246
+ context.fillStyle = labelColor;
1247
+ context.fillText(label, 32, 41);
1248
+ }
1249
+ return new CanvasTexture(canvas);
1250
+ })));
1251
+ this.connect('scale', combineLatest([
1252
+ this.select('active'),
1253
+ this.select('axisHeadScale'),
1254
+ this.select('label').pipe(startWithUndefined()),
1255
+ ]).pipe(map(([active, axisHeadScale, label]) => (label ? 1 : 0.75) * (active ? 1.2 : 1) * axisHeadScale)));
1256
+ }
1257
+ onPointerOver(event) {
1258
+ if (!this.get('disabled')) {
1259
+ event.stopPropagation();
1260
+ this.set({ active: true });
1261
+ }
1262
+ }
1263
+ onPointerOut(event) {
1264
+ if (!this.get('disabled')) {
1265
+ if (this.get('clickEmitter')?.observed) {
1266
+ this.get('clickEmitter').emit(event);
1267
+ }
1268
+ else {
1269
+ event.stopPropagation();
1270
+ this.set({ active: false });
1271
+ }
1272
+ }
1273
+ }
1274
+ }
1275
+ NgtsGizmoViewportAxisHead.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewportAxisHead, deps: null, target: i0.ɵɵFactoryTarget.Component });
1276
+ NgtsGizmoViewportAxisHead.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsGizmoViewportAxisHead, isStandalone: true, selector: "ngts-gizmo-viewport-axis-head", inputs: { arcStyle: "arcStyle", label: "label", labelColor: "labelColor", axisHeadScale: "axisHeadScale", disabled: "disabled", font: "font", clickEmitter: "clickEmitter" }, usesInheritance: true, ngImport: i0, template: `
1277
+ <ngt-sprite
1278
+ ngtCompound
1279
+ [scale]="get('scale')"
1280
+ (pointerover)="onPointerOver($any($event))"
1281
+ (pointerout)="onPointerOut($any($event))"
1282
+ >
1283
+ <ngt-sprite-material
1284
+ [map]="get('texture')"
1285
+ [opacity]="get('label') ? 1 : 0.75"
1286
+ [alphaTest]="0.3"
1287
+ [toneMapped]="false"
1288
+ >
1289
+ <ngt-value [rawValue]="gl.outputEncoding" attach="map.encoding" />
1290
+ <ngt-value [rawValue]="gl.capabilities.getMaxAnisotropy() || 1" attach="map.anisotropy" />
1291
+ </ngt-sprite-material>
1292
+ </ngt-sprite>
1293
+ `, isInline: true });
1294
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewportAxisHead, decorators: [{
1295
+ type: Component,
1296
+ args: [{
1297
+ selector: 'ngts-gizmo-viewport-axis-head',
1298
+ standalone: true,
1299
+ template: `
1300
+ <ngt-sprite
1301
+ ngtCompound
1302
+ [scale]="get('scale')"
1303
+ (pointerover)="onPointerOver($any($event))"
1304
+ (pointerout)="onPointerOut($any($event))"
1305
+ >
1306
+ <ngt-sprite-material
1307
+ [map]="get('texture')"
1308
+ [opacity]="get('label') ? 1 : 0.75"
1309
+ [alphaTest]="0.3"
1310
+ [toneMapped]="false"
1311
+ >
1312
+ <ngt-value [rawValue]="gl.outputEncoding" attach="map.encoding" />
1313
+ <ngt-value [rawValue]="gl.capabilities.getMaxAnisotropy() || 1" attach="map.anisotropy" />
1314
+ </ngt-sprite-material>
1315
+ </ngt-sprite>
1316
+ `,
1317
+ imports: [NgtArgs],
1318
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1319
+ }]
1320
+ }], propDecorators: { arcStyle: [{
1321
+ type: Input
1322
+ }], label: [{
1323
+ type: Input
1324
+ }], labelColor: [{
1325
+ type: Input
1326
+ }], axisHeadScale: [{
1327
+ type: Input
1328
+ }], disabled: [{
1329
+ type: Input
1330
+ }], font: [{
1331
+ type: Input
1332
+ }], clickEmitter: [{
1333
+ type: Input
1334
+ }] } });
1335
+
1336
+ extend({ Group, AmbientLight, PointLight });
1337
+ class NgtsGizmoViewport extends NgtRxStore {
1338
+ constructor() {
1339
+ super(...arguments);
1340
+ this.gizmoHelperApi = inject(NGTS_GIZMO_HELPER_API);
1341
+ this.Math = Math;
1342
+ this.clicked = new EventEmitter();
1343
+ }
1344
+ set axisColors(axisColors) {
1345
+ this.set({ axisColors });
1346
+ }
1347
+ set axisScale(axisScale) {
1348
+ this.set({ axisScale });
1349
+ }
1350
+ set labels(labels) {
1351
+ this.set({ labels });
1352
+ }
1353
+ set axisHeadScale(axisHeadScale) {
1354
+ this.set({ axisHeadScale });
1355
+ }
1356
+ set labelColor(labelColor) {
1357
+ this.set({ labelColor });
1358
+ }
1359
+ set hideNegativeAxes(hideNegativeAxes) {
1360
+ this.set({ hideNegativeAxes });
1361
+ }
1362
+ set hideAxisHeads(hideAxisHeads) {
1363
+ this.set({ hideAxisHeads });
1364
+ }
1365
+ set disabled(disabled) {
1366
+ this.set({ disabled });
1367
+ }
1368
+ set font(font) {
1369
+ this.set({ font });
1370
+ }
1371
+ initialize() {
1372
+ super.initialize();
1373
+ this.set({
1374
+ font: '18px Inter var, Arial, sans-serif',
1375
+ axisColors: ['#ff2060', '#20df80', '#2080ff'],
1376
+ axisHeadScale: 1,
1377
+ labels: ['X', 'Y', 'Z'],
1378
+ labelColor: '#000',
1379
+ });
1380
+ }
1381
+ onPointerDown(event) {
1382
+ if (!this.get('disabled')) {
1383
+ event.stopPropagation();
1384
+ this.gizmoHelperApi.tweenCamera(event.object.position);
1385
+ }
1386
+ }
1387
+ }
1388
+ NgtsGizmoViewport.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewport, deps: null, target: i0.ɵɵFactoryTarget.Component });
1389
+ NgtsGizmoViewport.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsGizmoViewport, isStandalone: true, selector: "ngts-gizmo-viewport", inputs: { axisColors: "axisColors", axisScale: "axisScale", labels: "labels", axisHeadScale: "axisHeadScale", labelColor: "labelColor", hideNegativeAxes: "hideNegativeAxes", hideAxisHeads: "hideAxisHeads", disabled: "disabled", font: "font" }, outputs: { clicked: "clicked" }, usesInheritance: true, ngImport: i0, template: `
1390
+ <ngt-group ngtCompound [scale]="40">
1391
+ <ngts-gizmo-viewport-axis
1392
+ [color]="get('axisColors')[0]"
1393
+ [rotation]="[0, 0, 0]"
1394
+ [scale]="get('axisScale')"
1395
+ ></ngts-gizmo-viewport-axis>
1396
+ <ngts-gizmo-viewport-axis
1397
+ [color]="get('axisColors')[1]"
1398
+ [rotation]="[0, 0, Math.PI / 2]"
1399
+ [scale]="get('axisScale')"
1400
+ ></ngts-gizmo-viewport-axis>
1401
+ <ngts-gizmo-viewport-axis
1402
+ [color]="get('axisColors')[2]"
1403
+ [rotation]="[0, -Math.PI / 2, 0]"
1404
+ [scale]="get('axisScale')"
1405
+ ></ngts-gizmo-viewport-axis>
1406
+ <ng-container *ngIf="!get('hideAxisHeads')">
1407
+ <ngts-gizmo-viewport-axis-head
1408
+ [arcStyle]="get('axisColors')[0]"
1409
+ [position]="[1, 0, 0]"
1410
+ [label]="get('labels')[0]"
1411
+ [font]="get('font')"
1412
+ [disabled]="get('disabled')"
1413
+ [labelColor]="get('labelColor')"
1414
+ [clickEmitter]="clicked"
1415
+ [axisHeadScale]="get('axisHeadScale')"
1416
+ (pointerdown)="onPointerDown($any($event))"
1417
+ ></ngts-gizmo-viewport-axis-head>
1418
+ <ngts-gizmo-viewport-axis-head
1419
+ [arcStyle]="get('axisColors')[1]"
1420
+ [position]="[0, 1, 0]"
1421
+ [label]="get('labels')[1]"
1422
+ [font]="get('font')"
1423
+ [disabled]="get('disabled')"
1424
+ [labelColor]="get('labelColor')"
1425
+ [clickEmitter]="clicked"
1426
+ [axisHeadScale]="get('axisHeadScale')"
1427
+ (pointerdown)="onPointerDown($any($event))"
1428
+ ></ngts-gizmo-viewport-axis-head>
1429
+ <ngts-gizmo-viewport-axis-head
1430
+ [arcStyle]="get('axisColors')[2]"
1431
+ [position]="[0, 0, 1]"
1432
+ [label]="get('labels')[2]"
1433
+ [font]="get('font')"
1434
+ [disabled]="get('disabled')"
1435
+ [labelColor]="get('labelColor')"
1436
+ [clickEmitter]="clicked"
1437
+ [axisHeadScale]="get('axisHeadScale')"
1438
+ (pointerdown)="onPointerDown($any($event))"
1439
+ ></ngts-gizmo-viewport-axis-head>
1440
+ <ng-container *ngIf="!get('hideNegativeAxes')">
1441
+ <ngts-gizmo-viewport-axis-head
1442
+ [arcStyle]="get('axisColors')[0]"
1443
+ [position]="[-1, 0, 0]"
1444
+ [font]="get('font')"
1445
+ [disabled]="get('disabled')"
1446
+ [labelColor]="get('labelColor')"
1447
+ [clickEmitter]="clicked"
1448
+ [axisHeadScale]="get('axisHeadScale')"
1449
+ (pointerdown)="onPointerDown($any($event))"
1450
+ ></ngts-gizmo-viewport-axis-head>
1451
+ <ngts-gizmo-viewport-axis-head
1452
+ [arcStyle]="get('axisColors')[1]"
1453
+ [position]="[0, -1, 0]"
1454
+ [font]="get('font')"
1455
+ [disabled]="get('disabled')"
1456
+ [labelColor]="get('labelColor')"
1457
+ [clickEmitter]="clicked"
1458
+ [axisHeadScale]="get('axisHeadScale')"
1459
+ (pointerdown)="onPointerDown($any($event))"
1460
+ ></ngts-gizmo-viewport-axis-head>
1461
+ <ngts-gizmo-viewport-axis-head
1462
+ [arcStyle]="get('axisColors')[2]"
1463
+ [position]="[0, 0, -1]"
1464
+ [font]="get('font')"
1465
+ [disabled]="get('disabled')"
1466
+ [labelColor]="get('labelColor')"
1467
+ [clickEmitter]="clicked"
1468
+ [axisHeadScale]="get('axisHeadScale')"
1469
+ (pointerdown)="onPointerDown($any($event))"
1470
+ ></ngts-gizmo-viewport-axis-head>
1471
+ </ng-container>
1472
+ </ng-container>
1473
+ <ngt-ambient-light intensity="0.5"></ngt-ambient-light>
1474
+ <ngt-point-light position="10" intensity="0.5"></ngt-point-light>
1475
+ </ngt-group>
1476
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsGizmoViewportAxis, selector: "ngts-gizmo-viewport-axis[color][rotation]", inputs: ["color", "rotation", "scale"] }, { kind: "component", type: NgtsGizmoViewportAxisHead, selector: "ngts-gizmo-viewport-axis-head", inputs: ["arcStyle", "label", "labelColor", "axisHeadScale", "disabled", "font", "clickEmitter"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1477
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewport, decorators: [{
1478
+ type: Component,
1479
+ args: [{
1480
+ selector: 'ngts-gizmo-viewport',
1481
+ standalone: true,
1482
+ template: `
1483
+ <ngt-group ngtCompound [scale]="40">
1484
+ <ngts-gizmo-viewport-axis
1485
+ [color]="get('axisColors')[0]"
1486
+ [rotation]="[0, 0, 0]"
1487
+ [scale]="get('axisScale')"
1488
+ ></ngts-gizmo-viewport-axis>
1489
+ <ngts-gizmo-viewport-axis
1490
+ [color]="get('axisColors')[1]"
1491
+ [rotation]="[0, 0, Math.PI / 2]"
1492
+ [scale]="get('axisScale')"
1493
+ ></ngts-gizmo-viewport-axis>
1494
+ <ngts-gizmo-viewport-axis
1495
+ [color]="get('axisColors')[2]"
1496
+ [rotation]="[0, -Math.PI / 2, 0]"
1497
+ [scale]="get('axisScale')"
1498
+ ></ngts-gizmo-viewport-axis>
1499
+ <ng-container *ngIf="!get('hideAxisHeads')">
1500
+ <ngts-gizmo-viewport-axis-head
1501
+ [arcStyle]="get('axisColors')[0]"
1502
+ [position]="[1, 0, 0]"
1503
+ [label]="get('labels')[0]"
1504
+ [font]="get('font')"
1505
+ [disabled]="get('disabled')"
1506
+ [labelColor]="get('labelColor')"
1507
+ [clickEmitter]="clicked"
1508
+ [axisHeadScale]="get('axisHeadScale')"
1509
+ (pointerdown)="onPointerDown($any($event))"
1510
+ ></ngts-gizmo-viewport-axis-head>
1511
+ <ngts-gizmo-viewport-axis-head
1512
+ [arcStyle]="get('axisColors')[1]"
1513
+ [position]="[0, 1, 0]"
1514
+ [label]="get('labels')[1]"
1515
+ [font]="get('font')"
1516
+ [disabled]="get('disabled')"
1517
+ [labelColor]="get('labelColor')"
1518
+ [clickEmitter]="clicked"
1519
+ [axisHeadScale]="get('axisHeadScale')"
1520
+ (pointerdown)="onPointerDown($any($event))"
1521
+ ></ngts-gizmo-viewport-axis-head>
1522
+ <ngts-gizmo-viewport-axis-head
1523
+ [arcStyle]="get('axisColors')[2]"
1524
+ [position]="[0, 0, 1]"
1525
+ [label]="get('labels')[2]"
1526
+ [font]="get('font')"
1527
+ [disabled]="get('disabled')"
1528
+ [labelColor]="get('labelColor')"
1529
+ [clickEmitter]="clicked"
1530
+ [axisHeadScale]="get('axisHeadScale')"
1531
+ (pointerdown)="onPointerDown($any($event))"
1532
+ ></ngts-gizmo-viewport-axis-head>
1533
+ <ng-container *ngIf="!get('hideNegativeAxes')">
1534
+ <ngts-gizmo-viewport-axis-head
1535
+ [arcStyle]="get('axisColors')[0]"
1536
+ [position]="[-1, 0, 0]"
1537
+ [font]="get('font')"
1538
+ [disabled]="get('disabled')"
1539
+ [labelColor]="get('labelColor')"
1540
+ [clickEmitter]="clicked"
1541
+ [axisHeadScale]="get('axisHeadScale')"
1542
+ (pointerdown)="onPointerDown($any($event))"
1543
+ ></ngts-gizmo-viewport-axis-head>
1544
+ <ngts-gizmo-viewport-axis-head
1545
+ [arcStyle]="get('axisColors')[1]"
1546
+ [position]="[0, -1, 0]"
1547
+ [font]="get('font')"
1548
+ [disabled]="get('disabled')"
1549
+ [labelColor]="get('labelColor')"
1550
+ [clickEmitter]="clicked"
1551
+ [axisHeadScale]="get('axisHeadScale')"
1552
+ (pointerdown)="onPointerDown($any($event))"
1553
+ ></ngts-gizmo-viewport-axis-head>
1554
+ <ngts-gizmo-viewport-axis-head
1555
+ [arcStyle]="get('axisColors')[2]"
1556
+ [position]="[0, 0, -1]"
1557
+ [font]="get('font')"
1558
+ [disabled]="get('disabled')"
1559
+ [labelColor]="get('labelColor')"
1560
+ [clickEmitter]="clicked"
1561
+ [axisHeadScale]="get('axisHeadScale')"
1562
+ (pointerdown)="onPointerDown($any($event))"
1563
+ ></ngts-gizmo-viewport-axis-head>
1564
+ </ng-container>
1565
+ </ng-container>
1566
+ <ngt-ambient-light intensity="0.5"></ngt-ambient-light>
1567
+ <ngt-point-light position="10" intensity="0.5"></ngt-point-light>
1568
+ </ngt-group>
1569
+ `,
1570
+ imports: [NgtsGizmoViewportAxis, NgtsGizmoViewportAxisHead, NgIf],
1571
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1572
+ }]
1573
+ }], propDecorators: { axisColors: [{
1574
+ type: Input
1575
+ }], axisScale: [{
1576
+ type: Input
1577
+ }], labels: [{
1578
+ type: Input
1579
+ }], axisHeadScale: [{
1580
+ type: Input
1581
+ }], labelColor: [{
1582
+ type: Input
1583
+ }], hideNegativeAxes: [{
1584
+ type: Input
1585
+ }], hideAxisHeads: [{
1586
+ type: Input
1587
+ }], disabled: [{
1588
+ type: Input
1589
+ }], font: [{
1590
+ type: Input
1591
+ }], clicked: [{
1592
+ type: Output
1593
+ }] } });
1594
+
1595
+ const v = new THREE.Vector3();
1596
+ class NgtsQuadraticBezierLine extends NgtsLineInput {
1597
+ constructor() {
1598
+ super(...arguments);
1599
+ this.curve = new THREE.QuadraticBezierCurve3(undefined, undefined, undefined);
1600
+ this.lineRef = injectNgtRef();
1601
+ }
1602
+ set start(start) {
1603
+ this.set({ start });
1604
+ }
1605
+ set end(end) {
1606
+ this.set({ end });
1607
+ }
1608
+ set mid(mid) {
1609
+ this.set({ mid });
1610
+ }
1611
+ set segments(segments) {
1612
+ this.set({ segments });
1613
+ }
1614
+ initialize() {
1615
+ super.initialize();
1616
+ this.set({ start: [0, 0, 0], end: [0, 0, 0], segments: 20 });
1617
+ }
1618
+ ngOnInit() {
1619
+ this.connect('points', combineLatest([
1620
+ this.select('start'),
1621
+ this.select('end'),
1622
+ this.select('mid').pipe(startWithUndefined()),
1623
+ this.select('segments'),
1624
+ ]).pipe(map(([start, end, mid, segments]) => this.getPoints(start, end, mid, segments))));
1625
+ this.replaceSetPoints();
1626
+ }
1627
+ replaceSetPoints() {
1628
+ this.hold(this.lineRef.$, (line) => {
1629
+ line.setPoints = (start, end, mid) => {
1630
+ const points = this.getPoints(start, end, mid);
1631
+ if (this.lineRef.nativeElement.geometry) {
1632
+ this.lineRef.nativeElement.geometry.setPositions(points.map((p) => p.toArray()).flat());
1633
+ }
1634
+ };
1635
+ });
1636
+ }
1637
+ getPoints(start, end, mid, segments = 20) {
1638
+ if (start instanceof THREE.Vector3)
1639
+ this.curve.v0.copy(start);
1640
+ else
1641
+ this.curve.v0.set(...start);
1642
+ if (end instanceof THREE.Vector3)
1643
+ this.curve.v2.copy(end);
1644
+ else
1645
+ this.curve.v2.set(...end);
1646
+ if (mid instanceof THREE.Vector3) {
1647
+ this.curve.v1.copy(mid);
1648
+ }
1649
+ else {
1650
+ this.curve.v1.copy(this.curve.v0
1651
+ .clone()
1652
+ .add(this.curve.v2.clone().sub(this.curve.v0))
1653
+ .add(v.set(0, this.curve.v0.y - this.curve.v2.y, 0)));
1654
+ }
1655
+ return this.curve.getPoints(segments);
1656
+ }
1657
+ }
1658
+ NgtsQuadraticBezierLine.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsQuadraticBezierLine, deps: null, target: i0.ɵɵFactoryTarget.Component });
1659
+ NgtsQuadraticBezierLine.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsQuadraticBezierLine, isStandalone: true, selector: "ngts-quadratic-bezier-line", inputs: { lineRef: "lineRef", start: "start", end: "end", mid: "mid", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
1660
+ <ngts-line
1661
+ [lineRef]="lineRef"
1662
+ [points]="get('points')"
1663
+ [color]="get('color')"
1664
+ [vertexColors]="get('vertexColors')"
1665
+ [resolution]="get('resolution')"
1666
+ [lineWidth]="get('lineWidth')"
1667
+ [alphaToCoverage]="get('alphaToCoverage')"
1668
+ [dashed]="get('dashed')"
1669
+ [dashScale]="get('dashScale')"
1670
+ [dashSize]="get('dashSize')"
1671
+ [dashOffset]="get('dashOffset')"
1672
+ [gapSize]="get('gapSize')"
1673
+ [wireframe]="get('wireframe')"
1674
+ [worldUnits]="get('worldUnits')"
1675
+ />
1676
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line[points]", inputs: ["lineRef", "points", "segments"] }] });
1677
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsQuadraticBezierLine, decorators: [{
1678
+ type: Component,
1679
+ args: [{
1680
+ selector: 'ngts-quadratic-bezier-line',
1681
+ standalone: true,
1682
+ template: `
1683
+ <ngts-line
1684
+ [lineRef]="lineRef"
1685
+ [points]="get('points')"
1686
+ [color]="get('color')"
1687
+ [vertexColors]="get('vertexColors')"
1688
+ [resolution]="get('resolution')"
1689
+ [lineWidth]="get('lineWidth')"
1690
+ [alphaToCoverage]="get('alphaToCoverage')"
1691
+ [dashed]="get('dashed')"
1692
+ [dashScale]="get('dashScale')"
1693
+ [dashSize]="get('dashSize')"
1694
+ [dashOffset]="get('dashOffset')"
1695
+ [gapSize]="get('gapSize')"
1696
+ [wireframe]="get('wireframe')"
1697
+ [worldUnits]="get('worldUnits')"
1698
+ />
1699
+ `,
1700
+ imports: [NgtsLine],
1701
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1702
+ }]
1703
+ }], propDecorators: { lineRef: [{
1704
+ type: Input
1705
+ }], start: [{
1706
+ type: Input
1707
+ }], end: [{
1708
+ type: Input
1709
+ }], mid: [{
1710
+ type: Input
1711
+ }], segments: [{
1712
+ type: Input
1713
+ }] } });
1714
+
1715
+ extend({ Mesh, TextGeometry });
1716
+ class NgtsText3D extends NgtRxStore {
1717
+ constructor() {
1718
+ super(...arguments);
1719
+ this.font$ = this.select('font').pipe(switchMap((font) => {
1720
+ if (typeof font === 'string')
1721
+ return fetch(font).then((res) => res.json());
1722
+ return of(font);
1723
+ }), map((fontData) => new FontLoader().parse(fontData)));
1724
+ this.geometryArgs$ = combineLatest([
1725
+ this.font$,
1726
+ this.select('text'),
1727
+ this.select('size'),
1728
+ this.select('height'),
1729
+ this.select('bevelThickness'),
1730
+ this.select('bevelSize'),
1731
+ this.select('bevelEnabled'),
1732
+ this.select('bevelSegments'),
1733
+ this.select('bevelOffset'),
1734
+ this.select('curveSegments'),
1735
+ this.select('letterSpacing'),
1736
+ this.select('lineHeight'),
1737
+ ]).pipe(map(([font, text, size, height, bevelThickness, bevelSize, bevelEnabled, bevelSegments, bevelOffset, curveSegments, letterSpacing, lineHeight,]) => [
1738
+ text,
1739
+ {
1740
+ font,
1741
+ size,
1742
+ height,
1743
+ bevelThickness,
1744
+ bevelSize,
1745
+ bevelSegments,
1746
+ bevelEnabled,
1747
+ bevelOffset,
1748
+ curveSegments,
1749
+ letterSpacing,
1750
+ lineHeight,
1751
+ },
1752
+ ]));
1753
+ }
1754
+ set font(font) {
1755
+ this.set({ font });
1756
+ }
1757
+ set text(text) {
1758
+ this.set({ text });
1759
+ }
1760
+ set bevelEnabled(bevelEnabled) {
1761
+ this.set({ bevelEnabled });
1762
+ }
1763
+ set bevelOffset(bevelOffset) {
1764
+ this.set({ bevelOffset });
1765
+ }
1766
+ set bevelSize(bevelSize) {
1767
+ this.set({ bevelSize });
1768
+ }
1769
+ set bevelThickness(bevelThickness) {
1770
+ this.set({ bevelThickness });
1771
+ }
1772
+ set curveSegments(curveSegments) {
1773
+ this.set({ curveSegments });
1774
+ }
1775
+ set bevelSegments(bevelSegments) {
1776
+ this.set({ bevelSegments });
1777
+ }
1778
+ set height(height) {
1779
+ this.set({ height });
1780
+ }
1781
+ set size(size) {
1782
+ this.set({ size });
1783
+ }
1784
+ set lineHeight(lineHeight) {
1785
+ this.set({ lineHeight });
1786
+ }
1787
+ set letterSpacing(letterSpacing) {
1788
+ this.set({ letterSpacing });
1789
+ }
1790
+ initialize() {
1791
+ super.initialize();
1792
+ this.set({
1793
+ letterSpacing: 0,
1794
+ lineHeight: 1,
1795
+ size: 1,
1796
+ height: 0.2,
1797
+ bevelThickness: 0.1,
1798
+ bevelSize: 0.01,
1799
+ bevelEnabled: false,
1800
+ bevelOffset: 0,
1801
+ bevelSegments: 4,
1802
+ curveSegments: 8,
1803
+ });
1804
+ }
1805
+ }
1806
+ NgtsText3D.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsText3D, deps: null, target: i0.ɵɵFactoryTarget.Component });
1807
+ NgtsText3D.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsText3D, isStandalone: true, selector: "ngts-text-3d[font]", inputs: { font: "font", text: "text", bevelEnabled: "bevelEnabled", bevelOffset: "bevelOffset", bevelSize: "bevelSize", bevelThickness: "bevelThickness", curveSegments: "curveSegments", bevelSegments: "bevelSegments", height: "height", size: "size", lineHeight: "lineHeight", letterSpacing: "letterSpacing" }, usesInheritance: true, ngImport: i0, template: `
1808
+ <ngt-mesh ngtCompound>
1809
+ <ngt-text-geometry *args="geometryArgs$ | ngtPush : null" />
1810
+ <ng-content />
1811
+ </ngt-mesh>
1812
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }, { kind: "pipe", type: NgtPush, name: "ngtPush" }] });
1813
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsText3D, decorators: [{
1814
+ type: Component,
1815
+ args: [{
1816
+ selector: 'ngts-text-3d[font]',
1817
+ standalone: true,
1818
+ template: `
1819
+ <ngt-mesh ngtCompound>
1820
+ <ngt-text-geometry *args="geometryArgs$ | ngtPush : null" />
1821
+ <ng-content />
1822
+ </ngt-mesh>
1823
+ `,
1824
+ imports: [NgtArgs, NgtPush],
1825
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1826
+ }]
1827
+ }], propDecorators: { font: [{
1828
+ type: Input
1829
+ }], text: [{
1830
+ type: Input
1831
+ }], bevelEnabled: [{
1832
+ type: Input
1833
+ }], bevelOffset: [{
1834
+ type: Input
1835
+ }], bevelSize: [{
1836
+ type: Input
1837
+ }], bevelThickness: [{
1838
+ type: Input
1839
+ }], curveSegments: [{
1840
+ type: Input
1841
+ }], bevelSegments: [{
1842
+ type: Input
1843
+ }], height: [{
1844
+ type: Input
1845
+ }], size: [{
1846
+ type: Input
1847
+ }], lineHeight: [{
1848
+ type: Input
1849
+ }], letterSpacing: [{
1850
+ type: Input
1851
+ }] } });
1852
+
1853
+ class NgtsText extends NgtRxStore {
1854
+ constructor() {
1855
+ super(...arguments);
1856
+ this.textRef = injectNgtRef();
1857
+ this.sync = new EventEmitter();
1858
+ this.store = inject(NgtStore);
1859
+ this.troikaText = new Text();
1860
+ }
1861
+ set text(text) {
1862
+ this.set({ text });
1863
+ }
1864
+ set characters(characters) {
1865
+ this.set({ characters });
1866
+ }
1867
+ set font(font) {
1868
+ this.set({ font });
1869
+ }
1870
+ set anchorX(anchorX) {
1871
+ this.set({ anchorX });
1872
+ }
1873
+ set anchorY(anchorY) {
1874
+ this.set({ anchorY });
1875
+ }
1876
+ initialize() {
1877
+ super.initialize();
1878
+ this.set({ anchorX: 'center', anchorY: 'middle', text: '' });
1879
+ }
1880
+ ngOnInit() {
1881
+ if (!this.textRef.nativeElement)
1882
+ this.textRef.nativeElement = this.troikaText;
1883
+ this.preloadFont();
1884
+ this.syncText();
1885
+ }
1886
+ ngOnDestroy() {
1887
+ this.troikaText.dispose();
1888
+ super.ngOnDestroy();
1889
+ }
1890
+ preloadFont() {
1891
+ const { font, characters } = this.get();
1892
+ if (font && characters) {
1893
+ preloadFont({ font, characters });
1894
+ }
1895
+ }
1896
+ syncText() {
1897
+ this.hold(this.select(), () => {
1898
+ const invalidate = this.store.get('invalidate');
1899
+ this.troikaText.sync(() => {
1900
+ invalidate();
1901
+ if (this.sync.observed)
1902
+ this.sync.next(this.troikaText);
1903
+ });
1904
+ });
1905
+ }
1906
+ }
1907
+ NgtsText.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsText, deps: null, target: i0.ɵɵFactoryTarget.Component });
1908
+ NgtsText.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsText, isStandalone: true, selector: "ngts-text[text]", inputs: { textRef: "textRef", text: "text", characters: "characters", font: "font", anchorX: "anchorX", anchorY: "anchorY" }, outputs: { sync: "sync" }, providers: [RxActionFactory], usesInheritance: true, ngImport: i0, template: `
1909
+ <ngt-primitive
1910
+ ngtCompound
1911
+ *args="[textRef.nativeElement]"
1912
+ [text]="get('text')"
1913
+ [anchorX]="get('anchorX')"
1914
+ [anchorY]="get('anchorY')"
1915
+ [font]="get('font')"
1916
+ >
1917
+ <ng-content />
1918
+ </ngt-primitive>
1919
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] });
1920
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsText, decorators: [{
1921
+ type: Component,
1922
+ args: [{
1923
+ selector: 'ngts-text[text]',
1924
+ standalone: true,
1925
+ template: `
1926
+ <ngt-primitive
1927
+ ngtCompound
1928
+ *args="[textRef.nativeElement]"
1929
+ [text]="get('text')"
1930
+ [anchorX]="get('anchorX')"
1931
+ [anchorY]="get('anchorY')"
1932
+ [font]="get('font')"
1933
+ >
1934
+ <ng-content />
1935
+ </ngt-primitive>
1936
+ `,
1937
+ imports: [NgtArgs],
1938
+ providers: [RxActionFactory],
1939
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1940
+ }]
1941
+ }], propDecorators: { textRef: [{
1942
+ type: Input
1943
+ }], text: [{
1944
+ type: Input
1945
+ }], characters: [{
1946
+ type: Input
1947
+ }], font: [{
1948
+ type: Input
1949
+ }], anchorX: [{
1950
+ type: Input
1951
+ }], anchorY: [{
1952
+ type: Input
1953
+ }], sync: [{
1954
+ type: Output
1955
+ }] } });
1956
+
1957
+ /**
1958
+ * Generated bundle index. Do not edit.
1959
+ */
1960
+
1961
+ export { NGTS_GIZMO_HELPER_API, NgtsBillboard, NgtsCatmullRomLine, NgtsCubicBezierLine, NgtsGizmoHelper, NgtsGizmoHelperContent, NgtsGizmoViewcube, NgtsGizmoViewport, NgtsLine, NgtsQuadraticBezierLine, NgtsText, NgtsText3D };
1962
+ //# sourceMappingURL=angular-three-soba-abstractions.mjs.map