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,1965 @@
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 !== null && resolution !== void 0 ? 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
+ var _a;
794
+ if ((_a = this.get('clickEmitter')) === null || _a === void 0 ? void 0 : _a.observed) {
795
+ this.get('clickEmitter').emit(event);
796
+ }
797
+ else {
798
+ event.stopPropagation();
799
+ this.gizmoHelperApi.tweenCamera(this.get('position'));
800
+ }
801
+ }
802
+ }
803
+ NgtsGizmoViewcubeEdgeCube.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewcubeEdgeCube, deps: null, target: i0.ɵɵFactoryTarget.Component });
804
+ 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: `
805
+ <ngt-mesh
806
+ [scale]="1.01"
807
+ [position]="get('position')"
808
+ (pointermove)="onPointerMove($any($event))"
809
+ (pointerout)="onPointerOut($any($event))"
810
+ (click)="onClick($any($event))"
811
+ >
812
+ <ngt-box-geometry *args="get('dimensions')" />
813
+ <ngt-mesh-basic-material
814
+ [color]="hover ? get('hoverColor') : 'white'"
815
+ [transparent]="true"
816
+ [opacity]="0.6"
817
+ [visible]="hover"
818
+ />
819
+ </ngt-mesh>
820
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] });
821
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewcubeEdgeCube, decorators: [{
822
+ type: Component,
823
+ args: [{
824
+ selector: 'ngts-gizmo-viewcube-edge-cube[dimensions][position]',
825
+ standalone: true,
826
+ template: `
827
+ <ngt-mesh
828
+ [scale]="1.01"
829
+ [position]="get('position')"
830
+ (pointermove)="onPointerMove($any($event))"
831
+ (pointerout)="onPointerOut($any($event))"
832
+ (click)="onClick($any($event))"
833
+ >
834
+ <ngt-box-geometry *args="get('dimensions')" />
835
+ <ngt-mesh-basic-material
836
+ [color]="hover ? get('hoverColor') : 'white'"
837
+ [transparent]="true"
838
+ [opacity]="0.6"
839
+ [visible]="hover"
840
+ />
841
+ </ngt-mesh>
842
+ `,
843
+ imports: [NgtArgs],
844
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
845
+ }]
846
+ }], propDecorators: { dimensions: [{
847
+ type: Input
848
+ }], position: [{
849
+ type: Input
850
+ }] } });
851
+
852
+ extend({ MeshLambertMaterial, Mesh, BoxGeometry });
853
+ class NgtsGizmoViewcubeFaceMaterial extends NgtsGizmoViewcubeInputs {
854
+ constructor() {
855
+ super(...arguments);
856
+ this.document = inject(DOCUMENT);
857
+ }
858
+ set index(index) {
859
+ this.set({ index });
860
+ }
861
+ set hover(hover) {
862
+ this.set({ hover });
863
+ }
864
+ set font(font) {
865
+ this.set({ font });
866
+ }
867
+ set color(color) {
868
+ this.set({ color });
869
+ }
870
+ initialize() {
871
+ super.initialize();
872
+ this.set({
873
+ font: '20px Inter var, Arial, sans-serif',
874
+ faces: defaultFaces,
875
+ color: colors.bg,
876
+ hoverColor: colors.hover,
877
+ textColor: colors.text,
878
+ strokeColor: colors.stroke,
879
+ opacity: 1,
880
+ });
881
+ this.connect('texture', this.select(['index', 'faces', 'color', 'font', 'textColor', 'strokeColor'], ({ index, faces, color, font, textColor, strokeColor }) => {
882
+ const canvas = this.document.createElement('canvas');
883
+ canvas.width = 128;
884
+ canvas.height = 128;
885
+ const context = canvas.getContext('2d');
886
+ context.fillStyle = color;
887
+ context.fillRect(0, 0, canvas.width, canvas.height);
888
+ context.strokeStyle = strokeColor;
889
+ context.strokeRect(0, 0, canvas.width, canvas.height);
890
+ context.font = font;
891
+ context.textAlign = 'center';
892
+ context.fillStyle = textColor;
893
+ context.fillText(faces[index].toUpperCase(), 64, 76);
894
+ return new CanvasTexture(canvas);
895
+ }));
896
+ }
897
+ }
898
+ NgtsGizmoViewcubeFaceMaterial.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewcubeFaceMaterial, deps: null, target: i0.ɵɵFactoryTarget.Component });
899
+ 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: `
900
+ <ngt-mesh-lambert-material
901
+ [attach]="['material', get('index')]"
902
+ [map]="get('texture')"
903
+ [color]="get('hover') ? get('hoverColor') : get('color')"
904
+ [opacity]="get('opacity')"
905
+ [transparent]="true"
906
+ >
907
+ <ngt-value [rawValue]="store.get('gl').outputEncoding" attach="map.encoding" />
908
+ <ngt-value [rawValue]="store.get('gl').capabilities.getMaxAnisotropy() || 1" attach="map.anisotrophy" />
909
+ </ngt-mesh-lambert-material>
910
+ `, isInline: true });
911
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewcubeFaceMaterial, decorators: [{
912
+ type: Component,
913
+ args: [{
914
+ selector: 'ngts-gizmo-viewcube-face-material[hover][index]',
915
+ standalone: true,
916
+ template: `
917
+ <ngt-mesh-lambert-material
918
+ [attach]="['material', get('index')]"
919
+ [map]="get('texture')"
920
+ [color]="get('hover') ? get('hoverColor') : get('color')"
921
+ [opacity]="get('opacity')"
922
+ [transparent]="true"
923
+ >
924
+ <ngt-value [rawValue]="store.get('gl').outputEncoding" attach="map.encoding" />
925
+ <ngt-value [rawValue]="store.get('gl').capabilities.getMaxAnisotropy() || 1" attach="map.anisotrophy" />
926
+ </ngt-mesh-lambert-material>
927
+ `,
928
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
929
+ }]
930
+ }], propDecorators: { index: [{
931
+ type: Input
932
+ }], hover: [{
933
+ type: Input
934
+ }], font: [{
935
+ type: Input
936
+ }], color: [{
937
+ type: Input
938
+ }] } });
939
+ class NgtsGizmoViewcubeFaceCube extends NgtsGizmoViewcubeInputs {
940
+ constructor() {
941
+ super(...arguments);
942
+ this.gizmoHelperApi = inject(NGTS_GIZMO_HELPER_API);
943
+ this.hover = -1;
944
+ }
945
+ set font(font) {
946
+ this.set({ font });
947
+ }
948
+ set color(color) {
949
+ this.set({ color });
950
+ }
951
+ onPointerMove(event) {
952
+ event.stopPropagation();
953
+ this.hover = Math.floor(event.faceIndex / 2);
954
+ }
955
+ onPointerOut(event) {
956
+ event.stopPropagation();
957
+ this.hover = -1;
958
+ }
959
+ onClick(event) {
960
+ var _a;
961
+ if ((_a = this.get('clickEmitter')) === null || _a === void 0 ? void 0 : _a.observed) {
962
+ this.get('clickEmitter').emit(event);
963
+ }
964
+ else {
965
+ event.stopPropagation();
966
+ this.gizmoHelperApi.tweenCamera(event.face.normal);
967
+ }
968
+ }
969
+ }
970
+ NgtsGizmoViewcubeFaceCube.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewcubeFaceCube, deps: null, target: i0.ɵɵFactoryTarget.Component });
971
+ 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: `
972
+ <ngt-mesh
973
+ (pointermove)="onPointerMove($any($event))"
974
+ (pointerout)="onPointerOut($any($event))"
975
+ (click)="onClick($any($event))"
976
+ >
977
+ <ngt-box-geometry />
978
+ <ngts-gizmo-viewcube-face-material
979
+ *ngFor="let i; repeat: 6"
980
+ [hover]="hover === i"
981
+ [index]="i"
982
+ [font]="get('font')"
983
+ [color]="get('color')"
984
+ [opacity]="get('opacity')"
985
+ [hoverColor]="get('hoverColor')"
986
+ [textColor]="get('textColor')"
987
+ [strokeColor]="get('strokeColor')"
988
+ [faces]="get('faces')"
989
+ />
990
+ </ngt-mesh>
991
+ `, 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"] }] });
992
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewcubeFaceCube, decorators: [{
993
+ type: Component,
994
+ args: [{
995
+ selector: 'ngts-gizmo-viewcube-face-cube',
996
+ standalone: true,
997
+ template: `
998
+ <ngt-mesh
999
+ (pointermove)="onPointerMove($any($event))"
1000
+ (pointerout)="onPointerOut($any($event))"
1001
+ (click)="onClick($any($event))"
1002
+ >
1003
+ <ngt-box-geometry />
1004
+ <ngts-gizmo-viewcube-face-material
1005
+ *ngFor="let i; repeat: 6"
1006
+ [hover]="hover === i"
1007
+ [index]="i"
1008
+ [font]="get('font')"
1009
+ [color]="get('color')"
1010
+ [opacity]="get('opacity')"
1011
+ [hoverColor]="get('hoverColor')"
1012
+ [textColor]="get('textColor')"
1013
+ [strokeColor]="get('strokeColor')"
1014
+ [faces]="get('faces')"
1015
+ />
1016
+ </ngt-mesh>
1017
+ `,
1018
+ imports: [NgtsGizmoViewcubeFaceMaterial, NgtRepeat],
1019
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1020
+ }]
1021
+ }], propDecorators: { font: [{
1022
+ type: Input
1023
+ }], color: [{
1024
+ type: Input
1025
+ }] } });
1026
+
1027
+ extend({ Group, AmbientLight, PointLight });
1028
+ class NgtsGizmoViewcube extends NgtsGizmoViewcubeInputs {
1029
+ constructor() {
1030
+ super(...arguments);
1031
+ this.edges = edges;
1032
+ this.edgeDimensions = edgeDimensions;
1033
+ this.corners = corners;
1034
+ this.cornerDimensions = cornerDimensions;
1035
+ this.clicked = new EventEmitter();
1036
+ }
1037
+ set font(font) {
1038
+ this.set({ font });
1039
+ }
1040
+ set color(color) {
1041
+ this.set({ color });
1042
+ }
1043
+ }
1044
+ NgtsGizmoViewcube.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewcube, deps: null, target: i0.ɵɵFactoryTarget.Component });
1045
+ 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: `
1046
+ <ngt-group [scale]="60">
1047
+ <ngts-gizmo-viewcube-face-cube
1048
+ [font]="get('font')"
1049
+ [color]="get('color')"
1050
+ [opacity]="get('opacity')"
1051
+ [hoverColor]="get('hoverColor')"
1052
+ [textColor]="get('textColor')"
1053
+ [strokeColor]="get('strokeColor')"
1054
+ [faces]="get('faces')"
1055
+ [clickEmitter]="clicked"
1056
+ />
1057
+
1058
+ <ngts-gizmo-viewcube-edge-cube
1059
+ *ngFor="let edge of edges; let i = index"
1060
+ [position]="edge"
1061
+ [dimensions]="edgeDimensions[i]"
1062
+ [font]="get('font')"
1063
+ [color]="get('color')"
1064
+ [opacity]="get('opacity')"
1065
+ [hoverColor]="get('hoverColor')"
1066
+ [textColor]="get('textColor')"
1067
+ [strokeColor]="get('strokeColor')"
1068
+ [faces]="get('faces')"
1069
+ [clickEmitter]="clicked"
1070
+ />
1071
+
1072
+ <ngts-gizmo-viewcube-edge-cube
1073
+ *ngFor="let corner of corners"
1074
+ [position]="corner"
1075
+ [dimensions]="cornerDimensions"
1076
+ [font]="get('font')"
1077
+ [color]="get('color')"
1078
+ [opacity]="get('opacity')"
1079
+ [hoverColor]="get('hoverColor')"
1080
+ [textColor]="get('textColor')"
1081
+ [strokeColor]="get('strokeColor')"
1082
+ [faces]="get('faces')"
1083
+ [clickEmitter]="clicked"
1084
+ />
1085
+
1086
+ <ngt-ambient-light [intensity]="0.5" />
1087
+ <ngt-point-light [position]="10" [intensity]="0.5" />
1088
+ </ngt-group>
1089
+ `, 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"] }] });
1090
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewcube, decorators: [{
1091
+ type: Component,
1092
+ args: [{
1093
+ selector: 'ngts-gizmo-viewcube',
1094
+ standalone: true,
1095
+ template: `
1096
+ <ngt-group [scale]="60">
1097
+ <ngts-gizmo-viewcube-face-cube
1098
+ [font]="get('font')"
1099
+ [color]="get('color')"
1100
+ [opacity]="get('opacity')"
1101
+ [hoverColor]="get('hoverColor')"
1102
+ [textColor]="get('textColor')"
1103
+ [strokeColor]="get('strokeColor')"
1104
+ [faces]="get('faces')"
1105
+ [clickEmitter]="clicked"
1106
+ />
1107
+
1108
+ <ngts-gizmo-viewcube-edge-cube
1109
+ *ngFor="let edge of edges; let i = index"
1110
+ [position]="edge"
1111
+ [dimensions]="edgeDimensions[i]"
1112
+ [font]="get('font')"
1113
+ [color]="get('color')"
1114
+ [opacity]="get('opacity')"
1115
+ [hoverColor]="get('hoverColor')"
1116
+ [textColor]="get('textColor')"
1117
+ [strokeColor]="get('strokeColor')"
1118
+ [faces]="get('faces')"
1119
+ [clickEmitter]="clicked"
1120
+ />
1121
+
1122
+ <ngts-gizmo-viewcube-edge-cube
1123
+ *ngFor="let corner of corners"
1124
+ [position]="corner"
1125
+ [dimensions]="cornerDimensions"
1126
+ [font]="get('font')"
1127
+ [color]="get('color')"
1128
+ [opacity]="get('opacity')"
1129
+ [hoverColor]="get('hoverColor')"
1130
+ [textColor]="get('textColor')"
1131
+ [strokeColor]="get('strokeColor')"
1132
+ [faces]="get('faces')"
1133
+ [clickEmitter]="clicked"
1134
+ />
1135
+
1136
+ <ngt-ambient-light [intensity]="0.5" />
1137
+ <ngt-point-light [position]="10" [intensity]="0.5" />
1138
+ </ngt-group>
1139
+ `,
1140
+ imports: [NgtsGizmoViewcubeEdgeCube, NgtsGizmoViewcubeFaceCube, NgFor],
1141
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1142
+ }]
1143
+ }], propDecorators: { font: [{
1144
+ type: Input
1145
+ }], color: [{
1146
+ type: Input
1147
+ }], clicked: [{
1148
+ type: Output
1149
+ }] } });
1150
+
1151
+ extend({ Group, Mesh, BoxGeometry, MeshBasicMaterial, Sprite, SpriteMaterial });
1152
+ class NgtsGizmoViewportAxis extends NgtRxStore {
1153
+ set color(color) {
1154
+ this.set({ color });
1155
+ }
1156
+ set rotation(rotation) {
1157
+ this.set({ rotation });
1158
+ }
1159
+ set scale(scale) {
1160
+ this.set({ scale: scale === undefined ? this.get('scale') : scale });
1161
+ }
1162
+ initialize() {
1163
+ super.initialize();
1164
+ this.set({ scale: [0.8, 0.05, 0.05] });
1165
+ }
1166
+ }
1167
+ NgtsGizmoViewportAxis.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewportAxis, deps: null, target: i0.ɵɵFactoryTarget.Component });
1168
+ 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: `
1169
+ <ngt-group [rotation]="get('rotation')">
1170
+ <ngt-mesh [position]="[0.4, 0, 0]">
1171
+ <ngt-box-geometry *args="get('scale')" />
1172
+ <ngt-mesh-basic-material [color]="get('color')" [toneMapped]="false" />
1173
+ </ngt-mesh>
1174
+ </ngt-group>
1175
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] });
1176
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewportAxis, decorators: [{
1177
+ type: Component,
1178
+ args: [{
1179
+ selector: 'ngts-gizmo-viewport-axis[color][rotation]',
1180
+ standalone: true,
1181
+ template: `
1182
+ <ngt-group [rotation]="get('rotation')">
1183
+ <ngt-mesh [position]="[0.4, 0, 0]">
1184
+ <ngt-box-geometry *args="get('scale')" />
1185
+ <ngt-mesh-basic-material [color]="get('color')" [toneMapped]="false" />
1186
+ </ngt-mesh>
1187
+ </ngt-group>
1188
+ `,
1189
+ imports: [NgtArgs],
1190
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1191
+ }]
1192
+ }], propDecorators: { color: [{
1193
+ type: Input
1194
+ }], rotation: [{
1195
+ type: Input
1196
+ }], scale: [{
1197
+ type: Input
1198
+ }] } });
1199
+ class NgtsGizmoViewportAxisHead extends NgtRxStore {
1200
+ constructor() {
1201
+ super(...arguments);
1202
+ this.document = inject(DOCUMENT);
1203
+ this.store = inject(NgtStore);
1204
+ this.gl = this.store.get('gl');
1205
+ }
1206
+ set arcStyle(arcStyle) {
1207
+ this.set({ arcStyle });
1208
+ }
1209
+ set label(label) {
1210
+ this.set({ label });
1211
+ }
1212
+ set labelColor(labelColor) {
1213
+ this.set({ labelColor });
1214
+ }
1215
+ set axisHeadScale(axisHeadScale) {
1216
+ this.set({ axisHeadScale });
1217
+ }
1218
+ set disabled(disabled) {
1219
+ this.set({ disabled });
1220
+ }
1221
+ set font(font) {
1222
+ this.set({ font });
1223
+ }
1224
+ set clickEmitter(clickEmitter) {
1225
+ this.set({ clickEmitter });
1226
+ }
1227
+ initialize() {
1228
+ super.initialize();
1229
+ this.set({ axisHeadScale: 1, active: false });
1230
+ this.connect('texture', combineLatest([
1231
+ this.select('arcStyle'),
1232
+ this.select('labelColor'),
1233
+ this.select('font'),
1234
+ this.select('label').pipe(startWithUndefined()),
1235
+ ]).pipe(map(([arcStyle, labelColor, font, label]) => {
1236
+ const canvas = this.document.createElement('canvas');
1237
+ canvas.width = 64;
1238
+ canvas.height = 64;
1239
+ const context = canvas.getContext('2d');
1240
+ context.beginPath();
1241
+ context.arc(32, 32, 16, 0, 2 * Math.PI);
1242
+ context.closePath();
1243
+ context.fillStyle = arcStyle;
1244
+ context.fill();
1245
+ if (label) {
1246
+ context.font = font;
1247
+ context.textAlign = 'center';
1248
+ context.fillStyle = labelColor;
1249
+ context.fillText(label, 32, 41);
1250
+ }
1251
+ return new CanvasTexture(canvas);
1252
+ })));
1253
+ this.connect('scale', combineLatest([
1254
+ this.select('active'),
1255
+ this.select('axisHeadScale'),
1256
+ this.select('label').pipe(startWithUndefined()),
1257
+ ]).pipe(map(([active, axisHeadScale, label]) => (label ? 1 : 0.75) * (active ? 1.2 : 1) * axisHeadScale)));
1258
+ }
1259
+ onPointerOver(event) {
1260
+ if (!this.get('disabled')) {
1261
+ event.stopPropagation();
1262
+ this.set({ active: true });
1263
+ }
1264
+ }
1265
+ onPointerOut(event) {
1266
+ var _a;
1267
+ if (!this.get('disabled')) {
1268
+ if ((_a = this.get('clickEmitter')) === null || _a === void 0 ? void 0 : _a.observed) {
1269
+ this.get('clickEmitter').emit(event);
1270
+ }
1271
+ else {
1272
+ event.stopPropagation();
1273
+ this.set({ active: false });
1274
+ }
1275
+ }
1276
+ }
1277
+ }
1278
+ NgtsGizmoViewportAxisHead.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewportAxisHead, deps: null, target: i0.ɵɵFactoryTarget.Component });
1279
+ 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: `
1280
+ <ngt-sprite
1281
+ ngtCompound
1282
+ [scale]="get('scale')"
1283
+ (pointerover)="onPointerOver($any($event))"
1284
+ (pointerout)="onPointerOut($any($event))"
1285
+ >
1286
+ <ngt-sprite-material
1287
+ [map]="get('texture')"
1288
+ [opacity]="get('label') ? 1 : 0.75"
1289
+ [alphaTest]="0.3"
1290
+ [toneMapped]="false"
1291
+ >
1292
+ <ngt-value [rawValue]="gl.outputEncoding" attach="map.encoding" />
1293
+ <ngt-value [rawValue]="gl.capabilities.getMaxAnisotropy() || 1" attach="map.anisotropy" />
1294
+ </ngt-sprite-material>
1295
+ </ngt-sprite>
1296
+ `, isInline: true });
1297
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewportAxisHead, decorators: [{
1298
+ type: Component,
1299
+ args: [{
1300
+ selector: 'ngts-gizmo-viewport-axis-head',
1301
+ standalone: true,
1302
+ template: `
1303
+ <ngt-sprite
1304
+ ngtCompound
1305
+ [scale]="get('scale')"
1306
+ (pointerover)="onPointerOver($any($event))"
1307
+ (pointerout)="onPointerOut($any($event))"
1308
+ >
1309
+ <ngt-sprite-material
1310
+ [map]="get('texture')"
1311
+ [opacity]="get('label') ? 1 : 0.75"
1312
+ [alphaTest]="0.3"
1313
+ [toneMapped]="false"
1314
+ >
1315
+ <ngt-value [rawValue]="gl.outputEncoding" attach="map.encoding" />
1316
+ <ngt-value [rawValue]="gl.capabilities.getMaxAnisotropy() || 1" attach="map.anisotropy" />
1317
+ </ngt-sprite-material>
1318
+ </ngt-sprite>
1319
+ `,
1320
+ imports: [NgtArgs],
1321
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1322
+ }]
1323
+ }], propDecorators: { arcStyle: [{
1324
+ type: Input
1325
+ }], label: [{
1326
+ type: Input
1327
+ }], labelColor: [{
1328
+ type: Input
1329
+ }], axisHeadScale: [{
1330
+ type: Input
1331
+ }], disabled: [{
1332
+ type: Input
1333
+ }], font: [{
1334
+ type: Input
1335
+ }], clickEmitter: [{
1336
+ type: Input
1337
+ }] } });
1338
+
1339
+ extend({ Group, AmbientLight, PointLight });
1340
+ class NgtsGizmoViewport extends NgtRxStore {
1341
+ constructor() {
1342
+ super(...arguments);
1343
+ this.gizmoHelperApi = inject(NGTS_GIZMO_HELPER_API);
1344
+ this.Math = Math;
1345
+ this.clicked = new EventEmitter();
1346
+ }
1347
+ set axisColors(axisColors) {
1348
+ this.set({ axisColors });
1349
+ }
1350
+ set axisScale(axisScale) {
1351
+ this.set({ axisScale });
1352
+ }
1353
+ set labels(labels) {
1354
+ this.set({ labels });
1355
+ }
1356
+ set axisHeadScale(axisHeadScale) {
1357
+ this.set({ axisHeadScale });
1358
+ }
1359
+ set labelColor(labelColor) {
1360
+ this.set({ labelColor });
1361
+ }
1362
+ set hideNegativeAxes(hideNegativeAxes) {
1363
+ this.set({ hideNegativeAxes });
1364
+ }
1365
+ set hideAxisHeads(hideAxisHeads) {
1366
+ this.set({ hideAxisHeads });
1367
+ }
1368
+ set disabled(disabled) {
1369
+ this.set({ disabled });
1370
+ }
1371
+ set font(font) {
1372
+ this.set({ font });
1373
+ }
1374
+ initialize() {
1375
+ super.initialize();
1376
+ this.set({
1377
+ font: '18px Inter var, Arial, sans-serif',
1378
+ axisColors: ['#ff2060', '#20df80', '#2080ff'],
1379
+ axisHeadScale: 1,
1380
+ labels: ['X', 'Y', 'Z'],
1381
+ labelColor: '#000',
1382
+ });
1383
+ }
1384
+ onPointerDown(event) {
1385
+ if (!this.get('disabled')) {
1386
+ event.stopPropagation();
1387
+ this.gizmoHelperApi.tweenCamera(event.object.position);
1388
+ }
1389
+ }
1390
+ }
1391
+ NgtsGizmoViewport.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewport, deps: null, target: i0.ɵɵFactoryTarget.Component });
1392
+ 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: `
1393
+ <ngt-group ngtCompound [scale]="40">
1394
+ <ngts-gizmo-viewport-axis
1395
+ [color]="get('axisColors')[0]"
1396
+ [rotation]="[0, 0, 0]"
1397
+ [scale]="get('axisScale')"
1398
+ ></ngts-gizmo-viewport-axis>
1399
+ <ngts-gizmo-viewport-axis
1400
+ [color]="get('axisColors')[1]"
1401
+ [rotation]="[0, 0, Math.PI / 2]"
1402
+ [scale]="get('axisScale')"
1403
+ ></ngts-gizmo-viewport-axis>
1404
+ <ngts-gizmo-viewport-axis
1405
+ [color]="get('axisColors')[2]"
1406
+ [rotation]="[0, -Math.PI / 2, 0]"
1407
+ [scale]="get('axisScale')"
1408
+ ></ngts-gizmo-viewport-axis>
1409
+ <ng-container *ngIf="!get('hideAxisHeads')">
1410
+ <ngts-gizmo-viewport-axis-head
1411
+ [arcStyle]="get('axisColors')[0]"
1412
+ [position]="[1, 0, 0]"
1413
+ [label]="get('labels')[0]"
1414
+ [font]="get('font')"
1415
+ [disabled]="get('disabled')"
1416
+ [labelColor]="get('labelColor')"
1417
+ [clickEmitter]="clicked"
1418
+ [axisHeadScale]="get('axisHeadScale')"
1419
+ (pointerdown)="onPointerDown($any($event))"
1420
+ ></ngts-gizmo-viewport-axis-head>
1421
+ <ngts-gizmo-viewport-axis-head
1422
+ [arcStyle]="get('axisColors')[1]"
1423
+ [position]="[0, 1, 0]"
1424
+ [label]="get('labels')[1]"
1425
+ [font]="get('font')"
1426
+ [disabled]="get('disabled')"
1427
+ [labelColor]="get('labelColor')"
1428
+ [clickEmitter]="clicked"
1429
+ [axisHeadScale]="get('axisHeadScale')"
1430
+ (pointerdown)="onPointerDown($any($event))"
1431
+ ></ngts-gizmo-viewport-axis-head>
1432
+ <ngts-gizmo-viewport-axis-head
1433
+ [arcStyle]="get('axisColors')[2]"
1434
+ [position]="[0, 0, 1]"
1435
+ [label]="get('labels')[2]"
1436
+ [font]="get('font')"
1437
+ [disabled]="get('disabled')"
1438
+ [labelColor]="get('labelColor')"
1439
+ [clickEmitter]="clicked"
1440
+ [axisHeadScale]="get('axisHeadScale')"
1441
+ (pointerdown)="onPointerDown($any($event))"
1442
+ ></ngts-gizmo-viewport-axis-head>
1443
+ <ng-container *ngIf="!get('hideNegativeAxes')">
1444
+ <ngts-gizmo-viewport-axis-head
1445
+ [arcStyle]="get('axisColors')[0]"
1446
+ [position]="[-1, 0, 0]"
1447
+ [font]="get('font')"
1448
+ [disabled]="get('disabled')"
1449
+ [labelColor]="get('labelColor')"
1450
+ [clickEmitter]="clicked"
1451
+ [axisHeadScale]="get('axisHeadScale')"
1452
+ (pointerdown)="onPointerDown($any($event))"
1453
+ ></ngts-gizmo-viewport-axis-head>
1454
+ <ngts-gizmo-viewport-axis-head
1455
+ [arcStyle]="get('axisColors')[1]"
1456
+ [position]="[0, -1, 0]"
1457
+ [font]="get('font')"
1458
+ [disabled]="get('disabled')"
1459
+ [labelColor]="get('labelColor')"
1460
+ [clickEmitter]="clicked"
1461
+ [axisHeadScale]="get('axisHeadScale')"
1462
+ (pointerdown)="onPointerDown($any($event))"
1463
+ ></ngts-gizmo-viewport-axis-head>
1464
+ <ngts-gizmo-viewport-axis-head
1465
+ [arcStyle]="get('axisColors')[2]"
1466
+ [position]="[0, 0, -1]"
1467
+ [font]="get('font')"
1468
+ [disabled]="get('disabled')"
1469
+ [labelColor]="get('labelColor')"
1470
+ [clickEmitter]="clicked"
1471
+ [axisHeadScale]="get('axisHeadScale')"
1472
+ (pointerdown)="onPointerDown($any($event))"
1473
+ ></ngts-gizmo-viewport-axis-head>
1474
+ </ng-container>
1475
+ </ng-container>
1476
+ <ngt-ambient-light intensity="0.5"></ngt-ambient-light>
1477
+ <ngt-point-light position="10" intensity="0.5"></ngt-point-light>
1478
+ </ngt-group>
1479
+ `, 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"] }] });
1480
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoViewport, decorators: [{
1481
+ type: Component,
1482
+ args: [{
1483
+ selector: 'ngts-gizmo-viewport',
1484
+ standalone: true,
1485
+ template: `
1486
+ <ngt-group ngtCompound [scale]="40">
1487
+ <ngts-gizmo-viewport-axis
1488
+ [color]="get('axisColors')[0]"
1489
+ [rotation]="[0, 0, 0]"
1490
+ [scale]="get('axisScale')"
1491
+ ></ngts-gizmo-viewport-axis>
1492
+ <ngts-gizmo-viewport-axis
1493
+ [color]="get('axisColors')[1]"
1494
+ [rotation]="[0, 0, Math.PI / 2]"
1495
+ [scale]="get('axisScale')"
1496
+ ></ngts-gizmo-viewport-axis>
1497
+ <ngts-gizmo-viewport-axis
1498
+ [color]="get('axisColors')[2]"
1499
+ [rotation]="[0, -Math.PI / 2, 0]"
1500
+ [scale]="get('axisScale')"
1501
+ ></ngts-gizmo-viewport-axis>
1502
+ <ng-container *ngIf="!get('hideAxisHeads')">
1503
+ <ngts-gizmo-viewport-axis-head
1504
+ [arcStyle]="get('axisColors')[0]"
1505
+ [position]="[1, 0, 0]"
1506
+ [label]="get('labels')[0]"
1507
+ [font]="get('font')"
1508
+ [disabled]="get('disabled')"
1509
+ [labelColor]="get('labelColor')"
1510
+ [clickEmitter]="clicked"
1511
+ [axisHeadScale]="get('axisHeadScale')"
1512
+ (pointerdown)="onPointerDown($any($event))"
1513
+ ></ngts-gizmo-viewport-axis-head>
1514
+ <ngts-gizmo-viewport-axis-head
1515
+ [arcStyle]="get('axisColors')[1]"
1516
+ [position]="[0, 1, 0]"
1517
+ [label]="get('labels')[1]"
1518
+ [font]="get('font')"
1519
+ [disabled]="get('disabled')"
1520
+ [labelColor]="get('labelColor')"
1521
+ [clickEmitter]="clicked"
1522
+ [axisHeadScale]="get('axisHeadScale')"
1523
+ (pointerdown)="onPointerDown($any($event))"
1524
+ ></ngts-gizmo-viewport-axis-head>
1525
+ <ngts-gizmo-viewport-axis-head
1526
+ [arcStyle]="get('axisColors')[2]"
1527
+ [position]="[0, 0, 1]"
1528
+ [label]="get('labels')[2]"
1529
+ [font]="get('font')"
1530
+ [disabled]="get('disabled')"
1531
+ [labelColor]="get('labelColor')"
1532
+ [clickEmitter]="clicked"
1533
+ [axisHeadScale]="get('axisHeadScale')"
1534
+ (pointerdown)="onPointerDown($any($event))"
1535
+ ></ngts-gizmo-viewport-axis-head>
1536
+ <ng-container *ngIf="!get('hideNegativeAxes')">
1537
+ <ngts-gizmo-viewport-axis-head
1538
+ [arcStyle]="get('axisColors')[0]"
1539
+ [position]="[-1, 0, 0]"
1540
+ [font]="get('font')"
1541
+ [disabled]="get('disabled')"
1542
+ [labelColor]="get('labelColor')"
1543
+ [clickEmitter]="clicked"
1544
+ [axisHeadScale]="get('axisHeadScale')"
1545
+ (pointerdown)="onPointerDown($any($event))"
1546
+ ></ngts-gizmo-viewport-axis-head>
1547
+ <ngts-gizmo-viewport-axis-head
1548
+ [arcStyle]="get('axisColors')[1]"
1549
+ [position]="[0, -1, 0]"
1550
+ [font]="get('font')"
1551
+ [disabled]="get('disabled')"
1552
+ [labelColor]="get('labelColor')"
1553
+ [clickEmitter]="clicked"
1554
+ [axisHeadScale]="get('axisHeadScale')"
1555
+ (pointerdown)="onPointerDown($any($event))"
1556
+ ></ngts-gizmo-viewport-axis-head>
1557
+ <ngts-gizmo-viewport-axis-head
1558
+ [arcStyle]="get('axisColors')[2]"
1559
+ [position]="[0, 0, -1]"
1560
+ [font]="get('font')"
1561
+ [disabled]="get('disabled')"
1562
+ [labelColor]="get('labelColor')"
1563
+ [clickEmitter]="clicked"
1564
+ [axisHeadScale]="get('axisHeadScale')"
1565
+ (pointerdown)="onPointerDown($any($event))"
1566
+ ></ngts-gizmo-viewport-axis-head>
1567
+ </ng-container>
1568
+ </ng-container>
1569
+ <ngt-ambient-light intensity="0.5"></ngt-ambient-light>
1570
+ <ngt-point-light position="10" intensity="0.5"></ngt-point-light>
1571
+ </ngt-group>
1572
+ `,
1573
+ imports: [NgtsGizmoViewportAxis, NgtsGizmoViewportAxisHead, NgIf],
1574
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1575
+ }]
1576
+ }], propDecorators: { axisColors: [{
1577
+ type: Input
1578
+ }], axisScale: [{
1579
+ type: Input
1580
+ }], labels: [{
1581
+ type: Input
1582
+ }], axisHeadScale: [{
1583
+ type: Input
1584
+ }], labelColor: [{
1585
+ type: Input
1586
+ }], hideNegativeAxes: [{
1587
+ type: Input
1588
+ }], hideAxisHeads: [{
1589
+ type: Input
1590
+ }], disabled: [{
1591
+ type: Input
1592
+ }], font: [{
1593
+ type: Input
1594
+ }], clicked: [{
1595
+ type: Output
1596
+ }] } });
1597
+
1598
+ const v = new THREE.Vector3();
1599
+ class NgtsQuadraticBezierLine extends NgtsLineInput {
1600
+ constructor() {
1601
+ super(...arguments);
1602
+ this.curve = new THREE.QuadraticBezierCurve3(undefined, undefined, undefined);
1603
+ this.lineRef = injectNgtRef();
1604
+ }
1605
+ set start(start) {
1606
+ this.set({ start });
1607
+ }
1608
+ set end(end) {
1609
+ this.set({ end });
1610
+ }
1611
+ set mid(mid) {
1612
+ this.set({ mid });
1613
+ }
1614
+ set segments(segments) {
1615
+ this.set({ segments });
1616
+ }
1617
+ initialize() {
1618
+ super.initialize();
1619
+ this.set({ start: [0, 0, 0], end: [0, 0, 0], segments: 20 });
1620
+ }
1621
+ ngOnInit() {
1622
+ this.connect('points', combineLatest([
1623
+ this.select('start'),
1624
+ this.select('end'),
1625
+ this.select('mid').pipe(startWithUndefined()),
1626
+ this.select('segments'),
1627
+ ]).pipe(map(([start, end, mid, segments]) => this.getPoints(start, end, mid, segments))));
1628
+ this.replaceSetPoints();
1629
+ }
1630
+ replaceSetPoints() {
1631
+ this.hold(this.lineRef.$, (line) => {
1632
+ line.setPoints = (start, end, mid) => {
1633
+ const points = this.getPoints(start, end, mid);
1634
+ if (this.lineRef.nativeElement.geometry) {
1635
+ this.lineRef.nativeElement.geometry.setPositions(points.map((p) => p.toArray()).flat());
1636
+ }
1637
+ };
1638
+ });
1639
+ }
1640
+ getPoints(start, end, mid, segments = 20) {
1641
+ if (start instanceof THREE.Vector3)
1642
+ this.curve.v0.copy(start);
1643
+ else
1644
+ this.curve.v0.set(...start);
1645
+ if (end instanceof THREE.Vector3)
1646
+ this.curve.v2.copy(end);
1647
+ else
1648
+ this.curve.v2.set(...end);
1649
+ if (mid instanceof THREE.Vector3) {
1650
+ this.curve.v1.copy(mid);
1651
+ }
1652
+ else {
1653
+ this.curve.v1.copy(this.curve.v0
1654
+ .clone()
1655
+ .add(this.curve.v2.clone().sub(this.curve.v0))
1656
+ .add(v.set(0, this.curve.v0.y - this.curve.v2.y, 0)));
1657
+ }
1658
+ return this.curve.getPoints(segments);
1659
+ }
1660
+ }
1661
+ NgtsQuadraticBezierLine.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsQuadraticBezierLine, deps: null, target: i0.ɵɵFactoryTarget.Component });
1662
+ 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: `
1663
+ <ngts-line
1664
+ [lineRef]="lineRef"
1665
+ [points]="get('points')"
1666
+ [color]="get('color')"
1667
+ [vertexColors]="get('vertexColors')"
1668
+ [resolution]="get('resolution')"
1669
+ [lineWidth]="get('lineWidth')"
1670
+ [alphaToCoverage]="get('alphaToCoverage')"
1671
+ [dashed]="get('dashed')"
1672
+ [dashScale]="get('dashScale')"
1673
+ [dashSize]="get('dashSize')"
1674
+ [dashOffset]="get('dashOffset')"
1675
+ [gapSize]="get('gapSize')"
1676
+ [wireframe]="get('wireframe')"
1677
+ [worldUnits]="get('worldUnits')"
1678
+ />
1679
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line[points]", inputs: ["lineRef", "points", "segments"] }] });
1680
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsQuadraticBezierLine, decorators: [{
1681
+ type: Component,
1682
+ args: [{
1683
+ selector: 'ngts-quadratic-bezier-line',
1684
+ standalone: true,
1685
+ template: `
1686
+ <ngts-line
1687
+ [lineRef]="lineRef"
1688
+ [points]="get('points')"
1689
+ [color]="get('color')"
1690
+ [vertexColors]="get('vertexColors')"
1691
+ [resolution]="get('resolution')"
1692
+ [lineWidth]="get('lineWidth')"
1693
+ [alphaToCoverage]="get('alphaToCoverage')"
1694
+ [dashed]="get('dashed')"
1695
+ [dashScale]="get('dashScale')"
1696
+ [dashSize]="get('dashSize')"
1697
+ [dashOffset]="get('dashOffset')"
1698
+ [gapSize]="get('gapSize')"
1699
+ [wireframe]="get('wireframe')"
1700
+ [worldUnits]="get('worldUnits')"
1701
+ />
1702
+ `,
1703
+ imports: [NgtsLine],
1704
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1705
+ }]
1706
+ }], propDecorators: { lineRef: [{
1707
+ type: Input
1708
+ }], start: [{
1709
+ type: Input
1710
+ }], end: [{
1711
+ type: Input
1712
+ }], mid: [{
1713
+ type: Input
1714
+ }], segments: [{
1715
+ type: Input
1716
+ }] } });
1717
+
1718
+ extend({ Mesh, TextGeometry });
1719
+ class NgtsText3D extends NgtRxStore {
1720
+ constructor() {
1721
+ super(...arguments);
1722
+ this.font$ = this.select('font').pipe(switchMap((font) => {
1723
+ if (typeof font === 'string')
1724
+ return fetch(font).then((res) => res.json());
1725
+ return of(font);
1726
+ }), map((fontData) => new FontLoader().parse(fontData)));
1727
+ this.geometryArgs$ = combineLatest([
1728
+ this.font$,
1729
+ this.select('text'),
1730
+ this.select('size'),
1731
+ this.select('height'),
1732
+ this.select('bevelThickness'),
1733
+ this.select('bevelSize'),
1734
+ this.select('bevelEnabled'),
1735
+ this.select('bevelSegments'),
1736
+ this.select('bevelOffset'),
1737
+ this.select('curveSegments'),
1738
+ this.select('letterSpacing'),
1739
+ this.select('lineHeight'),
1740
+ ]).pipe(map(([font, text, size, height, bevelThickness, bevelSize, bevelEnabled, bevelSegments, bevelOffset, curveSegments, letterSpacing, lineHeight,]) => [
1741
+ text,
1742
+ {
1743
+ font,
1744
+ size,
1745
+ height,
1746
+ bevelThickness,
1747
+ bevelSize,
1748
+ bevelSegments,
1749
+ bevelEnabled,
1750
+ bevelOffset,
1751
+ curveSegments,
1752
+ letterSpacing,
1753
+ lineHeight,
1754
+ },
1755
+ ]));
1756
+ }
1757
+ set font(font) {
1758
+ this.set({ font });
1759
+ }
1760
+ set text(text) {
1761
+ this.set({ text });
1762
+ }
1763
+ set bevelEnabled(bevelEnabled) {
1764
+ this.set({ bevelEnabled });
1765
+ }
1766
+ set bevelOffset(bevelOffset) {
1767
+ this.set({ bevelOffset });
1768
+ }
1769
+ set bevelSize(bevelSize) {
1770
+ this.set({ bevelSize });
1771
+ }
1772
+ set bevelThickness(bevelThickness) {
1773
+ this.set({ bevelThickness });
1774
+ }
1775
+ set curveSegments(curveSegments) {
1776
+ this.set({ curveSegments });
1777
+ }
1778
+ set bevelSegments(bevelSegments) {
1779
+ this.set({ bevelSegments });
1780
+ }
1781
+ set height(height) {
1782
+ this.set({ height });
1783
+ }
1784
+ set size(size) {
1785
+ this.set({ size });
1786
+ }
1787
+ set lineHeight(lineHeight) {
1788
+ this.set({ lineHeight });
1789
+ }
1790
+ set letterSpacing(letterSpacing) {
1791
+ this.set({ letterSpacing });
1792
+ }
1793
+ initialize() {
1794
+ super.initialize();
1795
+ this.set({
1796
+ letterSpacing: 0,
1797
+ lineHeight: 1,
1798
+ size: 1,
1799
+ height: 0.2,
1800
+ bevelThickness: 0.1,
1801
+ bevelSize: 0.01,
1802
+ bevelEnabled: false,
1803
+ bevelOffset: 0,
1804
+ bevelSegments: 4,
1805
+ curveSegments: 8,
1806
+ });
1807
+ }
1808
+ }
1809
+ NgtsText3D.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsText3D, deps: null, target: i0.ɵɵFactoryTarget.Component });
1810
+ 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: `
1811
+ <ngt-mesh ngtCompound>
1812
+ <ngt-text-geometry *args="geometryArgs$ | ngtPush : null" />
1813
+ <ng-content />
1814
+ </ngt-mesh>
1815
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }, { kind: "pipe", type: NgtPush, name: "ngtPush" }] });
1816
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsText3D, decorators: [{
1817
+ type: Component,
1818
+ args: [{
1819
+ selector: 'ngts-text-3d[font]',
1820
+ standalone: true,
1821
+ template: `
1822
+ <ngt-mesh ngtCompound>
1823
+ <ngt-text-geometry *args="geometryArgs$ | ngtPush : null" />
1824
+ <ng-content />
1825
+ </ngt-mesh>
1826
+ `,
1827
+ imports: [NgtArgs, NgtPush],
1828
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1829
+ }]
1830
+ }], propDecorators: { font: [{
1831
+ type: Input
1832
+ }], text: [{
1833
+ type: Input
1834
+ }], bevelEnabled: [{
1835
+ type: Input
1836
+ }], bevelOffset: [{
1837
+ type: Input
1838
+ }], bevelSize: [{
1839
+ type: Input
1840
+ }], bevelThickness: [{
1841
+ type: Input
1842
+ }], curveSegments: [{
1843
+ type: Input
1844
+ }], bevelSegments: [{
1845
+ type: Input
1846
+ }], height: [{
1847
+ type: Input
1848
+ }], size: [{
1849
+ type: Input
1850
+ }], lineHeight: [{
1851
+ type: Input
1852
+ }], letterSpacing: [{
1853
+ type: Input
1854
+ }] } });
1855
+
1856
+ class NgtsText extends NgtRxStore {
1857
+ constructor() {
1858
+ super(...arguments);
1859
+ this.textRef = injectNgtRef();
1860
+ this.sync = new EventEmitter();
1861
+ this.store = inject(NgtStore);
1862
+ this.troikaText = new Text();
1863
+ }
1864
+ set text(text) {
1865
+ this.set({ text });
1866
+ }
1867
+ set characters(characters) {
1868
+ this.set({ characters });
1869
+ }
1870
+ set font(font) {
1871
+ this.set({ font });
1872
+ }
1873
+ set anchorX(anchorX) {
1874
+ this.set({ anchorX });
1875
+ }
1876
+ set anchorY(anchorY) {
1877
+ this.set({ anchorY });
1878
+ }
1879
+ initialize() {
1880
+ super.initialize();
1881
+ this.set({ anchorX: 'center', anchorY: 'middle', text: '' });
1882
+ }
1883
+ ngOnInit() {
1884
+ if (!this.textRef.nativeElement)
1885
+ this.textRef.nativeElement = this.troikaText;
1886
+ this.preloadFont();
1887
+ this.syncText();
1888
+ }
1889
+ ngOnDestroy() {
1890
+ this.troikaText.dispose();
1891
+ super.ngOnDestroy();
1892
+ }
1893
+ preloadFont() {
1894
+ const { font, characters } = this.get();
1895
+ if (font && characters) {
1896
+ preloadFont({ font, characters });
1897
+ }
1898
+ }
1899
+ syncText() {
1900
+ this.hold(this.select(), () => {
1901
+ const invalidate = this.store.get('invalidate');
1902
+ this.troikaText.sync(() => {
1903
+ invalidate();
1904
+ if (this.sync.observed)
1905
+ this.sync.next(this.troikaText);
1906
+ });
1907
+ });
1908
+ }
1909
+ }
1910
+ NgtsText.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsText, deps: null, target: i0.ɵɵFactoryTarget.Component });
1911
+ 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: `
1912
+ <ngt-primitive
1913
+ ngtCompound
1914
+ *args="[textRef.nativeElement]"
1915
+ [text]="get('text')"
1916
+ [anchorX]="get('anchorX')"
1917
+ [anchorY]="get('anchorY')"
1918
+ [font]="get('font')"
1919
+ >
1920
+ <ng-content />
1921
+ </ngt-primitive>
1922
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] });
1923
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsText, decorators: [{
1924
+ type: Component,
1925
+ args: [{
1926
+ selector: 'ngts-text[text]',
1927
+ standalone: true,
1928
+ template: `
1929
+ <ngt-primitive
1930
+ ngtCompound
1931
+ *args="[textRef.nativeElement]"
1932
+ [text]="get('text')"
1933
+ [anchorX]="get('anchorX')"
1934
+ [anchorY]="get('anchorY')"
1935
+ [font]="get('font')"
1936
+ >
1937
+ <ng-content />
1938
+ </ngt-primitive>
1939
+ `,
1940
+ imports: [NgtArgs],
1941
+ providers: [RxActionFactory],
1942
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1943
+ }]
1944
+ }], propDecorators: { textRef: [{
1945
+ type: Input
1946
+ }], text: [{
1947
+ type: Input
1948
+ }], characters: [{
1949
+ type: Input
1950
+ }], font: [{
1951
+ type: Input
1952
+ }], anchorX: [{
1953
+ type: Input
1954
+ }], anchorY: [{
1955
+ type: Input
1956
+ }], sync: [{
1957
+ type: Output
1958
+ }] } });
1959
+
1960
+ /**
1961
+ * Generated bundle index. Do not edit.
1962
+ */
1963
+
1964
+ export { NGTS_GIZMO_HELPER_API, NgtsBillboard, NgtsCatmullRomLine, NgtsCubicBezierLine, NgtsGizmoHelper, NgtsGizmoHelperContent, NgtsGizmoViewcube, NgtsGizmoViewport, NgtsLine, NgtsQuadraticBezierLine, NgtsText, NgtsText3D };
1965
+ //# sourceMappingURL=angular-three-soba-abstractions.mjs.map