angular-three-soba 2.0.0 → 2.2.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 (72) hide show
  1. package/abstractions/lib/catmull-rom-line.d.ts +148 -148
  2. package/abstractions/lib/edges.d.ts +166 -166
  3. package/abstractions/lib/grid.d.ts +30 -30
  4. package/abstractions/lib/line.d.ts +2 -2
  5. package/abstractions/lib/prism-geometry.d.ts +4 -4
  6. package/abstractions/lib/rounded-box.d.ts +1 -1
  7. package/abstractions/lib/text-3d.d.ts +37 -37
  8. package/abstractions/lib/text.d.ts +2 -2
  9. package/cameras/lib/cube-camera.d.ts +1 -1
  10. package/cameras/lib/orthographic-camera.d.ts +1 -1
  11. package/cameras/lib/perspective-camera.d.ts +1 -1
  12. package/controls/index.d.ts +9 -1
  13. package/controls/lib/camera-controls.d.ts +1 -1
  14. package/controls/lib/orbit-controls.d.ts +1 -1
  15. package/esm2022/controls/index.mjs +6 -2
  16. package/esm2022/gizmos/angular-three-soba-gizmos.mjs +5 -0
  17. package/esm2022/gizmos/index.mjs +6 -0
  18. package/esm2022/gizmos/lib/gizmo-helper/gizmo-helper.mjs +187 -0
  19. package/esm2022/gizmos/lib/gizmo-helper/gizmo-viewcube.mjs +304 -0
  20. package/esm2022/gizmos/lib/gizmo-helper/gizmo-viewport.mjs +332 -0
  21. package/esm2022/gizmos/lib/pivot-controls/axis-arrow.mjs +263 -0
  22. package/esm2022/gizmos/lib/pivot-controls/axis-rotator.mjs +264 -0
  23. package/esm2022/gizmos/lib/pivot-controls/pivot-controls.mjs +340 -0
  24. package/esm2022/gizmos/lib/pivot-controls/plane-slider.mjs +266 -0
  25. package/esm2022/gizmos/lib/pivot-controls/scaling-sphere.mjs +232 -0
  26. package/esm2022/gizmos/lib/transform-controls.mjs +177 -0
  27. package/esm2022/staging/index.mjs +2 -1
  28. package/esm2022/staging/lib/mask.mjs +78 -0
  29. package/fesm2022/angular-three-soba-controls.mjs +14 -1337
  30. package/fesm2022/angular-three-soba-controls.mjs.map +1 -1
  31. package/fesm2022/angular-three-soba-gizmos.mjs +2319 -0
  32. package/fesm2022/angular-three-soba-gizmos.mjs.map +1 -0
  33. package/fesm2022/angular-three-soba-staging.mjs +92 -21
  34. package/fesm2022/angular-three-soba-staging.mjs.map +1 -1
  35. package/gizmos/README.md +3 -0
  36. package/gizmos/index.d.ts +5 -0
  37. package/gizmos/lib/gizmo-helper/gizmo-helper.d.ts +45 -0
  38. package/gizmos/lib/gizmo-helper/gizmo-viewcube.d.ts +74 -0
  39. package/gizmos/lib/gizmo-helper/gizmo-viewport.d.ts +64 -0
  40. package/{controls → gizmos}/lib/pivot-controls/pivot-controls.d.ts +1 -1
  41. package/gizmos/lib/transform-controls.d.ts +50 -0
  42. package/materials/lib/custom-shader-material.d.ts +3 -3
  43. package/materials/lib/mesh-refraction-material.d.ts +3 -3
  44. package/materials/lib/mesh-transmission-material.d.ts +1 -1
  45. package/misc/lib/computed-attribute.d.ts +5 -5
  46. package/misc/lib/decal.d.ts +1 -1
  47. package/misc/lib/html/html.d.ts +1 -1
  48. package/misc/lib/sampler.d.ts +1 -1
  49. package/package.json +18 -12
  50. package/performances/lib/instances/instances.d.ts +9 -9
  51. package/performances/lib/points/points.d.ts +20 -20
  52. package/performances/lib/segments/segments.d.ts +4 -4
  53. package/shaders/lib/mesh-refraction-material.d.ts +2 -2
  54. package/staging/index.d.ts +1 -0
  55. package/staging/lib/caustics.d.ts +1 -1
  56. package/staging/lib/center.d.ts +2 -2
  57. package/staging/lib/contact-shadows.d.ts +1 -1
  58. package/staging/lib/lightformer.d.ts +1 -1
  59. package/staging/lib/mask.d.ts +30 -0
  60. package/staging/lib/render-texture.d.ts +1 -1
  61. package/staging/lib/sky.d.ts +1 -1
  62. package/staging/lib/spot-light.d.ts +2 -2
  63. package/staging/lib/stage.d.ts +6 -6
  64. package/esm2022/controls/lib/pivot-controls/axis-arrow.mjs +0 -263
  65. package/esm2022/controls/lib/pivot-controls/axis-rotator.mjs +0 -264
  66. package/esm2022/controls/lib/pivot-controls/pivot-controls.mjs +0 -340
  67. package/esm2022/controls/lib/pivot-controls/plane-slider.mjs +0 -266
  68. package/esm2022/controls/lib/pivot-controls/scaling-sphere.mjs +0 -232
  69. /package/{controls → gizmos}/lib/pivot-controls/axis-arrow.d.ts +0 -0
  70. /package/{controls → gizmos}/lib/pivot-controls/axis-rotator.d.ts +0 -0
  71. /package/{controls → gizmos}/lib/pivot-controls/plane-slider.d.ts +0 -0
  72. /package/{controls → gizmos}/lib/pivot-controls/scaling-sphere.d.ts +0 -0
@@ -1,24 +1,23 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, output, computed, effect, Component, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, viewChild, ElementRef, inject, signal, afterNextRender, model, untracked, Directive } from '@angular/core';
3
- import { omit, injectStore, pick, extend, injectBeforeRender, NgtArgs, getLocalState, NgtHTML, provideHTMLDomElement } from 'angular-three';
2
+ import { input, output, computed, effect, Component, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, model, inject, afterNextRender, untracked, ElementRef, Directive } from '@angular/core';
3
+ import { omit, injectStore, pick, extend, injectBeforeRender, NgtArgs, NgtHTML, provideHTMLDomElement } from 'angular-three';
4
4
  import CameraControls from 'camera-controls';
5
5
  import { mergeInputs } from 'ngxtension/inject-inputs';
6
- import { Box3, MathUtils, Matrix4, Quaternion, Raycaster, Sphere, Spherical, Vector2, Vector3, Vector4, DoubleSide, Group, Mesh, ConeGeometry, CylinderGeometry, MeshBasicMaterial, Ray, Plane, PlaneGeometry, SphereGeometry } from 'three';
6
+ import { Box3, MathUtils, Matrix4, Quaternion, Raycaster, Sphere, Spherical, Vector2, Vector3, Vector4 } from 'three';
7
7
  import { OrbitControls } from 'three-stdlib';
8
- import { NgtsHTML, NgtsHTMLContent, calculateScaleFactor } from 'angular-three-soba/misc';
9
- import { injectAutoEffect } from 'ngxtension/auto-effect';
10
- import { NgtsLine } from 'angular-three-soba/abstractions';
11
8
  import { DOCUMENT } from '@angular/common';
12
9
  import { easing } from 'maath';
10
+ import { injectAutoEffect } from 'ngxtension/auto-effect';
11
+ import { NgtsPivotControls as NgtsPivotControls$1 } from 'angular-three-soba/gizmos';
13
12
 
14
- const defaultOptions$3 = {
13
+ const defaultOptions$2 = {
15
14
  makeDefault: false,
16
15
  events: false,
17
16
  regress: false,
18
17
  };
19
18
  class NgtsCameraControls {
20
19
  constructor() {
21
- this.options = input(defaultOptions$3, { transform: mergeInputs(defaultOptions$3) });
20
+ this.options = input(defaultOptions$2, { transform: mergeInputs(defaultOptions$2) });
22
21
  this.parameters = omit(this.options, ['makeDefault', 'camera', 'regress', 'domElement']);
23
22
  this.changed = output();
24
23
  this.started = output();
@@ -132,7 +131,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
132
131
  }]
133
132
  }], ctorParameters: () => [] });
134
133
 
135
- const defaultOptions$2 = {
134
+ const defaultOptions$1 = {
136
135
  enableDamping: true,
137
136
  regress: false,
138
137
  makeDefault: false,
@@ -140,7 +139,7 @@ const defaultOptions$2 = {
140
139
  };
141
140
  class NgtsOrbitControls {
142
141
  constructor() {
143
- this.options = input(defaultOptions$2, { transform: mergeInputs(defaultOptions$2) });
142
+ this.options = input(defaultOptions$1, { transform: mergeInputs(defaultOptions$1) });
144
143
  this.parameters = omit(this.options, ['makeDefault', 'camera', 'regress', 'domElement', 'keyEvents', 'enableDamping']);
145
144
  this.changed = output();
146
145
  this.started = output();
@@ -259,1333 +258,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
259
258
  }]
260
259
  }], ctorParameters: () => [] });
261
260
 
262
- const vec1$1 = new Vector3();
263
- const vec2$1 = new Vector3();
264
- function calculateOffset$1(clickPoint, normal, rayStart, rayDir) {
265
- const e1 = normal.dot(normal);
266
- const e2 = normal.dot(clickPoint) - normal.dot(rayStart);
267
- const e3 = normal.dot(rayDir);
268
- if (e3 === 0) {
269
- return -e2 / e1;
270
- }
271
- vec1$1
272
- .copy(rayDir)
273
- .multiplyScalar(e1 / e3)
274
- .sub(normal);
275
- vec2$1
276
- .copy(rayDir)
277
- .multiplyScalar(e2 / e3)
278
- .add(rayStart)
279
- .sub(clickPoint);
280
- return -vec1$1.dot(vec2$1) / vec1$1.dot(vec1$1);
281
- }
282
- const upV$1 = new Vector3(0, 1, 0);
283
- const offsetMatrix$1 = new Matrix4();
284
- class NgtsAxisArrow {
285
- constructor() {
286
- this.DoubleSide = DoubleSide;
287
- this.direction = input.required();
288
- this.axis = input.required();
289
- this.groupRef = viewChild.required('group');
290
- this.annotationRef = viewChild('annotation', { read: ElementRef });
291
- this.pivotControls = inject(NgtsPivotControls);
292
- this.store = injectStore();
293
- this.controls = this.store.select('controls');
294
- this.hovered = signal(false);
295
- this.clickInfo = null;
296
- this.offset0 = 0;
297
- this.color = computed(() => this.hovered() ? this.pivotControls.hoveredColor() : this.pivotControls.axisColors()[this.axis()]);
298
- this.coneWidth = computed(() => this.pivotControls.fixed()
299
- ? (this.pivotControls.lineWidth() / this.pivotControls.scale()) * 1.6
300
- : this.pivotControls.scale() / 20);
301
- this.coneLength = computed(() => (this.pivotControls.fixed() ? 0.2 : this.pivotControls.scale() / 5));
302
- this.cylinderLength = computed(() => this.pivotControls.fixed() ? 1 - this.coneLength() : this.pivotControls.scale() - this.coneLength());
303
- this.matrixL = computed(() => {
304
- const quaternion = new Quaternion().setFromUnitVectors(upV$1, this.direction().clone().normalize());
305
- return new Matrix4().makeRotationFromQuaternion(quaternion);
306
- });
307
- extend({ Group, Mesh, ConeGeometry, CylinderGeometry, MeshBasicMaterial });
308
- }
309
- onPointerDown(event) {
310
- const [group, direction, axis, controls, annotation] = [
311
- this.groupRef().nativeElement,
312
- this.direction(),
313
- this.axis(),
314
- this.controls(),
315
- this.annotationRef()?.nativeElement,
316
- ];
317
- if (annotation) {
318
- annotation.innerText = `${this.pivotControls.translation[axis].toFixed(2)}`;
319
- annotation.style.display = 'block';
320
- }
321
- event.stopPropagation();
322
- const rotation = new Matrix4().extractRotation(group.matrixWorld);
323
- const origin = new Vector3().setFromMatrixPosition(group.matrixWorld);
324
- const clickPoint = event.point.clone();
325
- const dir = direction.clone().applyMatrix4(rotation).normalize();
326
- this.clickInfo = { clickPoint, dir };
327
- this.offset0 = this.pivotControls.translation[axis];
328
- this.pivotControls.onDragStart({ component: 'Arrow', axis, origin, directions: [dir] });
329
- if (controls) {
330
- controls.enabled = false;
331
- }
332
- // @ts-expect-error - setPointerCapture is not in the type definition
333
- event.target.setPointerCapture(event.pointerId);
334
- }
335
- onPointerUp(event) {
336
- const [annotation, controls] = [this.annotationRef()?.nativeElement, this.controls()];
337
- if (annotation) {
338
- annotation.style.display = 'none';
339
- }
340
- event.stopPropagation();
341
- this.clickInfo = null;
342
- this.pivotControls.onDragEnd();
343
- if (controls) {
344
- controls.enabled = true;
345
- }
346
- // @ts-expect-error - setPointerCapture is not in the type definition
347
- event.target.releasePointerCapture(event.pointerId);
348
- }
349
- onPointerMove(event) {
350
- event.stopPropagation();
351
- if (!this.hovered()) {
352
- this.hovered.set(true);
353
- }
354
- if (this.clickInfo) {
355
- const { clickPoint, dir } = this.clickInfo;
356
- const [translationLimits, annotation, axis] = [
357
- this.pivotControls.translationLimits(),
358
- this.annotationRef()?.nativeElement,
359
- this.axis(),
360
- ];
361
- const [min, max] = translationLimits?.[axis] || [undefined, undefined];
362
- let offset = calculateOffset$1(clickPoint, dir, event.ray.origin, event.ray.direction);
363
- if (min !== undefined) {
364
- offset = Math.max(offset, min - this.offset0);
365
- }
366
- if (max !== undefined) {
367
- offset = Math.min(offset, max - this.offset0);
368
- }
369
- this.pivotControls.translation[axis] = this.offset0 + offset;
370
- if (annotation) {
371
- annotation.innerText = `${this.pivotControls.translation[axis].toFixed(2)}`;
372
- }
373
- offsetMatrix$1.makeTranslation(dir.x * offset, dir.y * offset, dir.z * offset);
374
- this.pivotControls.onDrag(offsetMatrix$1);
375
- }
376
- }
377
- onPointerOut(event) {
378
- event.stopPropagation();
379
- this.hovered.set(false);
380
- }
381
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsAxisArrow, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
382
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: NgtsAxisArrow, isStandalone: true, selector: "ngts-axis-arrow", inputs: { direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: true, transformFunction: null }, axis: { classPropertyName: "axis", publicName: "axis", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "groupRef", first: true, predicate: ["group"], descendants: true, isSignal: true }, { propertyName: "annotationRef", first: true, predicate: ["annotation"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: `
383
- <ngt-group #group>
384
- <ngt-group
385
- [matrix]="matrixL()"
386
- [matrixAutoUpdate]="false"
387
- (pointerdown)="onPointerDown($any($event))"
388
- (pointerup)="onPointerUp($any($event))"
389
- (pointermove)="onPointerMove($any($event))"
390
- (pointerout)="onPointerOut($any($event))"
391
- >
392
- @if (pivotControls.annotations()) {
393
- <ngts-html [options]="{ position: [0, -coneLength(), 0] }">
394
- <div
395
- #annotation
396
- ngtsHTMLContent
397
- style="display: none; background: #151520; color: white; padding: 6px 8px; border-radius: 7px; white-space: nowrap;"
398
- [class]="pivotControls.annotationsClass()"
399
- ></div>
400
- </ngts-html>
401
- }
402
- <ngt-mesh
403
- [visible]="false"
404
- [position]="[0, (cylinderLength() + coneLength()) / 2.0, 0]"
405
- [userData]="pivotControls.userData()"
406
- >
407
- <ngt-cylinder-geometry
408
- *args="[coneWidth() * 1.4, coneWidth() * 1.4, cylinderLength() + coneLength(), 8, 1]"
409
- />
410
- </ngt-mesh>
411
-
412
- <ngts-line
413
- [points]="[0, 0, 0, 0, cylinderLength(), 0]"
414
- [options]="{
415
- raycast: null,
416
- side: DoubleSide,
417
- polygonOffset: true,
418
- polygonOffsetFactor: -10,
419
- renderOrder: 1,
420
- fog: false,
421
- transparent: true,
422
- lineWidth: pivotControls.lineWidth(),
423
- color: color(),
424
- opacity: pivotControls.opacity(),
425
- depthTest: pivotControls.depthTest(),
426
- }"
427
- />
428
-
429
- <ngt-mesh [raycast]="null" [position]="[0, cylinderLength() + coneLength() / 2.0, 0]" [renderOrder]="500">
430
- <ngt-cone-geometry *args="[coneWidth(), coneLength(), 24, 1]" />
431
- <ngt-mesh-basic-material
432
- [transparent]="true"
433
- [depthTest]="pivotControls.depthTest()"
434
- [color]="color()"
435
- [opacity]="pivotControls.opacity()"
436
- [polygonOffset]="true"
437
- [polygonOffsetFactor]="-10"
438
- [fog]="false"
439
- />
440
- </ngt-mesh>
441
- </ngt-group>
442
- </ngt-group>
443
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtsLine, selector: "ngts-line", inputs: ["points", "options"] }, { kind: "component", type: NgtsHTML, selector: "ngts-html", inputs: ["options"] }, { kind: "component", type: NgtsHTMLContent, selector: "[ngtsHTMLContent]", inputs: ["ngtsHTMLContent"], outputs: ["occluded"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
444
- }
445
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsAxisArrow, decorators: [{
446
- type: Component,
447
- args: [{
448
- selector: 'ngts-axis-arrow',
449
- standalone: true,
450
- template: `
451
- <ngt-group #group>
452
- <ngt-group
453
- [matrix]="matrixL()"
454
- [matrixAutoUpdate]="false"
455
- (pointerdown)="onPointerDown($any($event))"
456
- (pointerup)="onPointerUp($any($event))"
457
- (pointermove)="onPointerMove($any($event))"
458
- (pointerout)="onPointerOut($any($event))"
459
- >
460
- @if (pivotControls.annotations()) {
461
- <ngts-html [options]="{ position: [0, -coneLength(), 0] }">
462
- <div
463
- #annotation
464
- ngtsHTMLContent
465
- style="display: none; background: #151520; color: white; padding: 6px 8px; border-radius: 7px; white-space: nowrap;"
466
- [class]="pivotControls.annotationsClass()"
467
- ></div>
468
- </ngts-html>
469
- }
470
- <ngt-mesh
471
- [visible]="false"
472
- [position]="[0, (cylinderLength() + coneLength()) / 2.0, 0]"
473
- [userData]="pivotControls.userData()"
474
- >
475
- <ngt-cylinder-geometry
476
- *args="[coneWidth() * 1.4, coneWidth() * 1.4, cylinderLength() + coneLength(), 8, 1]"
477
- />
478
- </ngt-mesh>
479
-
480
- <ngts-line
481
- [points]="[0, 0, 0, 0, cylinderLength(), 0]"
482
- [options]="{
483
- raycast: null,
484
- side: DoubleSide,
485
- polygonOffset: true,
486
- polygonOffsetFactor: -10,
487
- renderOrder: 1,
488
- fog: false,
489
- transparent: true,
490
- lineWidth: pivotControls.lineWidth(),
491
- color: color(),
492
- opacity: pivotControls.opacity(),
493
- depthTest: pivotControls.depthTest(),
494
- }"
495
- />
496
-
497
- <ngt-mesh [raycast]="null" [position]="[0, cylinderLength() + coneLength() / 2.0, 0]" [renderOrder]="500">
498
- <ngt-cone-geometry *args="[coneWidth(), coneLength(), 24, 1]" />
499
- <ngt-mesh-basic-material
500
- [transparent]="true"
501
- [depthTest]="pivotControls.depthTest()"
502
- [color]="color()"
503
- [opacity]="pivotControls.opacity()"
504
- [polygonOffset]="true"
505
- [polygonOffsetFactor]="-10"
506
- [fog]="false"
507
- />
508
- </ngt-mesh>
509
- </ngt-group>
510
- </ngt-group>
511
- `,
512
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
513
- changeDetection: ChangeDetectionStrategy.OnPush,
514
- imports: [NgtArgs, NgtsLine, NgtsHTML, NgtsHTMLContent],
515
- }]
516
- }], ctorParameters: () => [] });
517
-
518
- const clickDir = new Vector3();
519
- const intersectionDir = new Vector3();
520
- function toDegrees(radians) {
521
- return (radians * 180) / Math.PI;
522
- }
523
- function toRadians(degrees) {
524
- return (degrees * Math.PI) / 180;
525
- }
526
- function calculateAngle(clickPoint, intersectionPoint, origin, e1, e2) {
527
- clickDir.copy(clickPoint).sub(origin);
528
- intersectionDir.copy(intersectionPoint).sub(origin);
529
- const dote1e1 = e1.dot(e1);
530
- const dote2e2 = e2.dot(e2);
531
- const uClick = clickDir.dot(e1) / dote1e1;
532
- const vClick = clickDir.dot(e2) / dote2e2;
533
- const uIntersection = intersectionDir.dot(e1) / dote1e1;
534
- const vIntersection = intersectionDir.dot(e2) / dote2e2;
535
- const angleClick = Math.atan2(vClick, uClick);
536
- const angleIntersection = Math.atan2(vIntersection, uIntersection);
537
- return angleIntersection - angleClick;
538
- }
539
- function fmod(num, denom) {
540
- let k = Math.floor(num / denom);
541
- k = k < 0 ? k + 1 : k;
542
- return num - k * denom;
543
- }
544
- function minimizeAngle(angle) {
545
- let result = fmod(angle, 2 * Math.PI);
546
- if (Math.abs(result) < 1e-6) {
547
- return 0.0;
548
- }
549
- if (result < 0.0) {
550
- result += 2 * Math.PI;
551
- }
552
- return result;
553
- }
554
- const rotMatrix = new Matrix4();
555
- const posNew = new Vector3();
556
- const ray$1 = new Ray();
557
- const intersection$1 = new Vector3();
558
- class NgtsAxisRotator {
559
- constructor() {
560
- this.DoubleSide = DoubleSide;
561
- this.dir1 = input.required();
562
- this.dir2 = input.required();
563
- this.axis = input.required();
564
- this.groupRef = viewChild.required('group');
565
- this.annotationRef = viewChild('annotation', { read: ElementRef });
566
- this.pivotControls = inject(NgtsPivotControls);
567
- this.store = injectStore();
568
- this.controls = this.store.select('controls');
569
- this.hovered = signal(false);
570
- this.angle = 0;
571
- this.angle0 = 0;
572
- this.clickInfo = null;
573
- this.matrixL = computed(() => {
574
- const dir1N = this.dir1().clone().normalize();
575
- const dir2N = this.dir2().clone().normalize();
576
- return new Matrix4().makeBasis(dir1N, dir2N, dir1N.clone().cross(dir2N));
577
- });
578
- this.r = computed(() => (this.pivotControls.fixed() ? 0.65 : this.pivotControls.scale() * 0.65));
579
- this.arc = computed(() => {
580
- const segments = 32;
581
- const points = [];
582
- for (let j = 0; j <= segments; j++) {
583
- const angle = (j * (Math.PI / 2)) / segments;
584
- points.push(new Vector3(Math.cos(angle) * this.r(), Math.sin(angle) * this.r(), 0));
585
- }
586
- return points;
587
- });
588
- extend({ Group });
589
- }
590
- onPointerDown(event) {
591
- const [annotation, group, axis, controls] = [
592
- this.annotationRef()?.nativeElement,
593
- this.groupRef().nativeElement,
594
- this.axis(),
595
- this.controls(),
596
- ];
597
- if (annotation) {
598
- annotation.innerText = `${toDegrees(this.angle).toFixed(0)}º`;
599
- annotation.style.display = 'block';
600
- }
601
- event.stopPropagation();
602
- const clickPoint = event.point.clone();
603
- const origin = new Vector3().setFromMatrixPosition(group.matrixWorld);
604
- const e1 = new Vector3().setFromMatrixColumn(group.matrixWorld, 0).normalize();
605
- const e2 = new Vector3().setFromMatrixColumn(group.matrixWorld, 1).normalize();
606
- const normal = new Vector3().setFromMatrixColumn(group.matrixWorld, 2).normalize();
607
- const plane = new Plane().setFromNormalAndCoplanarPoint(normal, origin);
608
- this.clickInfo = { clickPoint, origin, e1, e2, normal, plane };
609
- this.pivotControls.onDragStart({ component: 'Rotator', axis, origin, directions: [e1, e2, normal] });
610
- if (controls) {
611
- controls.enabled = false;
612
- }
613
- // @ts-expect-error - setPointerCapture is not a function on PointerEvent
614
- event.target.setPointerCapture(event.pointerId);
615
- }
616
- onPointerMove(event) {
617
- event.stopPropagation();
618
- if (!this.hovered())
619
- this.hovered.set(true);
620
- if (this.clickInfo) {
621
- const { clickPoint, origin, e1, e2, normal, plane } = this.clickInfo;
622
- const [rotationLimits, axis, annotation] = [
623
- this.pivotControls.rotationLimits(),
624
- this.axis(),
625
- this.annotationRef()?.nativeElement,
626
- ];
627
- const [min, max] = rotationLimits?.[axis] || [undefined, undefined];
628
- ray$1.copy(event.ray);
629
- ray$1.intersectPlane(plane, intersection$1);
630
- ray$1.direction.negate();
631
- ray$1.intersectPlane(plane, intersection$1);
632
- let deltaAngle = calculateAngle(clickPoint, intersection$1, origin, e1, e2);
633
- let degrees = toDegrees(deltaAngle);
634
- if (event.shiftKey) {
635
- degrees = Math.round(degrees / 10) * 10;
636
- deltaAngle = toRadians(degrees);
637
- }
638
- if (min !== undefined && max !== undefined && max - min < 2 * Math.PI) {
639
- deltaAngle = minimizeAngle(deltaAngle);
640
- deltaAngle = deltaAngle > Math.PI ? deltaAngle - 2 * Math.PI : deltaAngle;
641
- deltaAngle = Math.round(deltaAngle / 10) * 10;
642
- this.angle = this.angle0 + deltaAngle;
643
- }
644
- else {
645
- this.angle = minimizeAngle(this.angle0 + deltaAngle);
646
- this.angle = this.angle > Math.PI ? this.angle - 2 * Math.PI : this.angle;
647
- }
648
- if (annotation) {
649
- degrees = toDegrees(this.angle);
650
- annotation.innerText = `${degrees.toFixed(0)}º`;
651
- }
652
- rotMatrix.makeRotationAxis(normal, deltaAngle);
653
- posNew.copy(origin).applyMatrix4(rotMatrix).sub(origin).negate();
654
- rotMatrix.setPosition(posNew);
655
- this.pivotControls.onDrag(rotMatrix);
656
- }
657
- }
658
- onPointerUp(event) {
659
- const [annotation, controls] = [this.annotationRef()?.nativeElement, this.controls()];
660
- if (annotation) {
661
- annotation.style.display = 'none';
662
- }
663
- event.stopPropagation();
664
- this.clickInfo = null;
665
- this.pivotControls.onDragEnd();
666
- if (controls) {
667
- controls.enabled = true;
668
- }
669
- // @ts-expect-error - releasePointerCapture is not a function on PointerEvent
670
- event.target.releasePointerCapture(event.pointerId);
671
- }
672
- onPointerOut(event) {
673
- event.stopPropagation();
674
- this.hovered.set(false);
675
- }
676
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsAxisRotator, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
677
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: NgtsAxisRotator, isStandalone: true, selector: "ngts-axis-rotator", inputs: { dir1: { classPropertyName: "dir1", publicName: "dir1", isSignal: true, isRequired: true, transformFunction: null }, dir2: { classPropertyName: "dir2", publicName: "dir2", isSignal: true, isRequired: true, transformFunction: null }, axis: { classPropertyName: "axis", publicName: "axis", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "groupRef", first: true, predicate: ["group"], descendants: true, isSignal: true }, { propertyName: "annotationRef", first: true, predicate: ["annotation"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: `
678
- <ngt-group
679
- #group
680
- [matrix]="matrixL()"
681
- [matrixAutoUpdate]="false"
682
- (pointerdown)="onPointerDown($any($event))"
683
- (pointermove)="onPointerMove($any($event))"
684
- (pointerup)="onPointerUp($any($event))"
685
- (pointerout)="onPointerOut($any($event))"
686
- >
687
- @if (pivotControls.annotations()) {
688
- <ngts-html [options]="{ position: [r(), r(), 0] }">
689
- <div
690
- #annotation
691
- ngtsHTMLContent
692
- style="display: none; background: #151520; color: white; padding: 6px 8px; border-radius: 7px; white-space: nowrap"
693
- [class]="pivotControls.annotationsClass()"
694
- ></div>
695
- </ngts-html>
696
- }
697
-
698
- <ngts-line
699
- [points]="arc()"
700
- [options]="{ lineWidth: pivotControls.lineWidth() * 4, visible: false, userData: pivotControls.userData() }"
701
- />
702
-
703
- <ngts-line
704
- [points]="arc()"
705
- [options]="{
706
- transparent: true,
707
- raycast: null,
708
- depthTest: pivotControls.depthTest(),
709
- lineWidth: pivotControls.lineWidth(),
710
- side: DoubleSide,
711
- color: hovered() ? pivotControls.hoveredColor() : pivotControls.axisColors()[axis()],
712
- opacity: pivotControls.opacity(),
713
- polygonOffset: true,
714
- polygonOffsetFactor: -10,
715
- fog: false,
716
- }"
717
- />
718
- </ngt-group>
719
- `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line", inputs: ["points", "options"] }, { kind: "component", type: NgtsHTML, selector: "ngts-html", inputs: ["options"] }, { kind: "component", type: NgtsHTMLContent, selector: "[ngtsHTMLContent]", inputs: ["ngtsHTMLContent"], outputs: ["occluded"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
720
- }
721
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsAxisRotator, decorators: [{
722
- type: Component,
723
- args: [{
724
- selector: 'ngts-axis-rotator',
725
- standalone: true,
726
- template: `
727
- <ngt-group
728
- #group
729
- [matrix]="matrixL()"
730
- [matrixAutoUpdate]="false"
731
- (pointerdown)="onPointerDown($any($event))"
732
- (pointermove)="onPointerMove($any($event))"
733
- (pointerup)="onPointerUp($any($event))"
734
- (pointerout)="onPointerOut($any($event))"
735
- >
736
- @if (pivotControls.annotations()) {
737
- <ngts-html [options]="{ position: [r(), r(), 0] }">
738
- <div
739
- #annotation
740
- ngtsHTMLContent
741
- style="display: none; background: #151520; color: white; padding: 6px 8px; border-radius: 7px; white-space: nowrap"
742
- [class]="pivotControls.annotationsClass()"
743
- ></div>
744
- </ngts-html>
745
- }
746
-
747
- <ngts-line
748
- [points]="arc()"
749
- [options]="{ lineWidth: pivotControls.lineWidth() * 4, visible: false, userData: pivotControls.userData() }"
750
- />
751
-
752
- <ngts-line
753
- [points]="arc()"
754
- [options]="{
755
- transparent: true,
756
- raycast: null,
757
- depthTest: pivotControls.depthTest(),
758
- lineWidth: pivotControls.lineWidth(),
759
- side: DoubleSide,
760
- color: hovered() ? pivotControls.hoveredColor() : pivotControls.axisColors()[axis()],
761
- opacity: pivotControls.opacity(),
762
- polygonOffset: true,
763
- polygonOffsetFactor: -10,
764
- fog: false,
765
- }"
766
- />
767
- </ngt-group>
768
- `,
769
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
770
- changeDetection: ChangeDetectionStrategy.OnPush,
771
- imports: [NgtsLine, NgtsHTML, NgtsHTMLContent],
772
- }]
773
- }], ctorParameters: () => [] });
774
-
775
- function decomposeIntoBasis(e1, e2, offset) {
776
- const i1 = Math.abs(e1.x) >= Math.abs(e1.y) && Math.abs(e1.x) >= Math.abs(e1.z)
777
- ? 0
778
- : Math.abs(e1.y) >= Math.abs(e1.x) && Math.abs(e1.y) >= Math.abs(e1.z)
779
- ? 1
780
- : 2;
781
- const e2DegrowthOrder = [0, 1, 2].sort((a, b) => Math.abs(e2.getComponent(b)) - Math.abs(e2.getComponent(a)));
782
- const i2 = i1 === e2DegrowthOrder[0] ? e2DegrowthOrder[1] : e2DegrowthOrder[0];
783
- const a1 = e1.getComponent(i1);
784
- const a2 = e1.getComponent(i2);
785
- const b1 = e2.getComponent(i1);
786
- const b2 = e2.getComponent(i2);
787
- const c1 = offset.getComponent(i1);
788
- const c2 = offset.getComponent(i2);
789
- const y = (c2 - c1 * (a2 / a1)) / (b2 - b1 * (a2 / a1));
790
- const x = (c1 - y * b1) / a1;
791
- return [x, y];
792
- }
793
- const ray = new Ray();
794
- const intersection = new Vector3();
795
- const offsetMatrix = new Matrix4();
796
- class NgtsPlaneSlider {
797
- constructor() {
798
- this.DoubleSide = DoubleSide;
799
- this.dir1 = input.required();
800
- this.dir2 = input.required();
801
- this.axis = input.required();
802
- this.groupRef = viewChild.required('group');
803
- this.annotationRef = viewChild('annotation', { read: ElementRef });
804
- this.pivotControls = inject(NgtsPivotControls);
805
- this.store = injectStore();
806
- this.controls = this.store.select('controls');
807
- this.hovered = signal(false);
808
- this.clickInfo = null;
809
- this.offsetX0 = 0;
810
- this.offsetY0 = 0;
811
- this.matrixL = computed(() => {
812
- const dir1N = this.dir1().clone().normalize();
813
- const dir2N = this.dir2().clone().normalize();
814
- return new Matrix4().makeBasis(dir1N, dir2N, dir1N.clone().cross(dir2N));
815
- });
816
- this.pos1 = computed(() => (this.pivotControls.fixed() ? 1 / 7 : this.pivotControls.scale() / 7));
817
- this.length = computed(() => (this.pivotControls.fixed() ? 0.225 : this.pivotControls.scale() * 0.225));
818
- this.color = computed(() => this.hovered() ? this.pivotControls.hoveredColor() : this.pivotControls.axisColors()[this.axis()]);
819
- this.points = computed(() => {
820
- const length = this.length();
821
- return [
822
- new Vector3(0, 0, 0),
823
- new Vector3(0, length, 0),
824
- new Vector3(length, length, 0),
825
- new Vector3(length, 0, 0),
826
- new Vector3(0, 0, 0),
827
- ];
828
- });
829
- extend({ Group, Mesh, PlaneGeometry, MeshBasicMaterial });
830
- }
831
- onPointerDown(event) {
832
- const [annotation, axis, group, controls] = [
833
- this.annotationRef()?.nativeElement,
834
- this.axis(),
835
- this.groupRef().nativeElement,
836
- this.controls(),
837
- ];
838
- if (annotation) {
839
- annotation.innerText = `${this.pivotControls.translation[(axis + 1) % 3].toFixed(2)}, ${this.pivotControls.translation[(axis + 2) % 3].toFixed(2)}`;
840
- annotation.style.display = 'block';
841
- }
842
- event.stopPropagation();
843
- const clickPoint = event.point.clone();
844
- const origin = new Vector3().setFromMatrixPosition(group.matrixWorld);
845
- const e1 = new Vector3().setFromMatrixColumn(group.matrixWorld, 0).normalize();
846
- const e2 = new Vector3().setFromMatrixColumn(group.matrixWorld, 1).normalize();
847
- const normal = new Vector3().setFromMatrixColumn(group.matrixWorld, 2).normalize();
848
- const plane = new Plane().setFromNormalAndCoplanarPoint(normal, origin);
849
- this.clickInfo = { clickPoint, e1, e2, plane };
850
- this.offsetX0 = this.pivotControls.translation[(axis + 1) % 3];
851
- this.offsetY0 = this.pivotControls.translation[(axis + 2) % 3];
852
- this.pivotControls.onDragStart({ component: 'Slider', axis, origin, directions: [e1, e2, normal] });
853
- if (controls) {
854
- controls.enabled = false;
855
- }
856
- // @ts-expect-error - setPointerCapture is not defined on ThreeEvent
857
- event.target.setPointerCapture(event.pointerId);
858
- }
859
- onPointerMove(event) {
860
- event.stopPropagation();
861
- if (!this.hovered())
862
- this.hovered.set(true);
863
- if (this.clickInfo) {
864
- const { clickPoint, e1, e2, plane } = this.clickInfo;
865
- const [translationLimits, axis, annotation] = [
866
- this.pivotControls.translationLimits(),
867
- this.axis(),
868
- this.annotationRef()?.nativeElement,
869
- ];
870
- const [minX, maxX] = translationLimits?.[(axis + 1) % 3] || [undefined, undefined];
871
- const [minY, maxY] = translationLimits?.[(axis + 2) % 3] || [undefined, undefined];
872
- ray.copy(event.ray);
873
- ray.intersectPlane(plane, intersection);
874
- ray.direction.negate();
875
- ray.intersectPlane(plane, intersection);
876
- intersection.sub(clickPoint);
877
- let [offsetX, offsetY] = decomposeIntoBasis(e1, e2, intersection);
878
- /* let offsetY = (intersection.y - (intersection.x * e1.y) / e1.x) / (e2.y - (e2.x * e1.y) / e1.x)
879
- let offsetX = (intersection.x - offsetY * e2.x) / e1.x */
880
- if (minX !== undefined) {
881
- offsetX = Math.max(offsetX, minX - this.offsetX0);
882
- }
883
- if (maxX !== undefined) {
884
- offsetX = Math.min(offsetX, maxX - this.offsetX0);
885
- }
886
- if (minY !== undefined) {
887
- offsetY = Math.max(offsetY, minY - this.offsetY0);
888
- }
889
- if (maxY !== undefined) {
890
- offsetY = Math.min(offsetY, maxY - this.offsetY0);
891
- }
892
- this.pivotControls.translation[(axis + 1) % 3] = this.offsetX0 + offsetX;
893
- this.pivotControls.translation[(axis + 2) % 3] = this.offsetY0 + offsetY;
894
- if (annotation) {
895
- annotation.innerText = `${this.pivotControls.translation[(axis + 1) % 3].toFixed(2)}, ${this.pivotControls.translation[(axis + 2) % 3].toFixed(2)}`;
896
- }
897
- offsetMatrix.makeTranslation(offsetX * e1.x + offsetY * e2.x, offsetX * e1.y + offsetY * e2.y, offsetX * e1.z + offsetY * e2.z);
898
- this.pivotControls.onDrag(offsetMatrix);
899
- }
900
- }
901
- onPointerUp(event) {
902
- const [annotation, controls] = [this.annotationRef()?.nativeElement, this.controls()];
903
- if (annotation) {
904
- annotation.style.display = 'none';
905
- }
906
- event.stopPropagation();
907
- this.clickInfo = null;
908
- this.pivotControls.onDragEnd();
909
- if (controls) {
910
- controls.enabled = true;
911
- }
912
- // @ts-expect-error - releasePointerCapture is not defined on ThreeEvent
913
- event.target.releasePointerCapture(event.pointerId);
914
- }
915
- onPointerOut(event) {
916
- event.stopPropagation();
917
- this.hovered.set(false);
918
- }
919
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsPlaneSlider, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
920
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: NgtsPlaneSlider, isStandalone: true, selector: "ngts-plane-slider", inputs: { dir1: { classPropertyName: "dir1", publicName: "dir1", isSignal: true, isRequired: true, transformFunction: null }, dir2: { classPropertyName: "dir2", publicName: "dir2", isSignal: true, isRequired: true, transformFunction: null }, axis: { classPropertyName: "axis", publicName: "axis", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "groupRef", first: true, predicate: ["group"], descendants: true, isSignal: true }, { propertyName: "annotationRef", first: true, predicate: ["annotation"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: `
921
- <ngt-group #group [matrix]="matrixL()" [matrixAutoUpdate]="false">
922
- @if (pivotControls.annotations()) {
923
- <ngts-html [options]="{ position: [0, 0, 0] }">
924
- <div
925
- #annotation
926
- ngtsHTMLContent
927
- style="display: none; background: #151520; color: white; padding: 6px 8px; border-radius: 7px; white-space: nowrap"
928
- [class]="pivotControls.annotationsClass()"
929
- ></div>
930
- </ngts-html>
931
- }
932
- <ngt-group [position]="[pos1() * 1.7, pos1() * 1.7, 0]">
933
- <ngt-mesh
934
- [visible]="true"
935
- [scale]="length()"
936
- [userData]="pivotControls.userData()"
937
- (pointerdown)="onPointerDown($any($event))"
938
- (pointermove)="onPointerMove($any($event))"
939
- (pointerup)="onPointerUp($any($event))"
940
- (pointerout)="onPointerOut($any($event))"
941
- >
942
- <ngt-plane-geometry />
943
- <ngt-mesh-basic-material
944
- [transparent]="true"
945
- [depthTest]="pivotControls.depthTest()"
946
- [color]="color()"
947
- [polygonOffset]="true"
948
- [polygonOffsetFactor]="-10"
949
- [side]="DoubleSide"
950
- [fog]="false"
951
- />
952
- </ngt-mesh>
953
- <ngts-line
954
- [points]="points()"
955
- [options]="{
956
- position: [-length() / 2, -length() / 2, 0],
957
- transparent: true,
958
- depthTest: pivotControls.depthTest(),
959
- lineWidth: pivotControls.lineWidth(),
960
- color: color(),
961
- opacity: pivotControls.opacity(),
962
- polygonOffset: true,
963
- polygonOffsetFactor: -10,
964
- userData: pivotControls.userData(),
965
- fog: false,
966
- }"
967
- />
968
- </ngt-group>
969
- </ngt-group>
970
- `, isInline: true, dependencies: [{ kind: "component", type: NgtsHTML, selector: "ngts-html", inputs: ["options"] }, { kind: "component", type: NgtsHTMLContent, selector: "[ngtsHTMLContent]", inputs: ["ngtsHTMLContent"], outputs: ["occluded"] }, { kind: "component", type: NgtsLine, selector: "ngts-line", inputs: ["points", "options"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
971
- }
972
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsPlaneSlider, decorators: [{
973
- type: Component,
974
- args: [{
975
- selector: 'ngts-plane-slider',
976
- standalone: true,
977
- template: `
978
- <ngt-group #group [matrix]="matrixL()" [matrixAutoUpdate]="false">
979
- @if (pivotControls.annotations()) {
980
- <ngts-html [options]="{ position: [0, 0, 0] }">
981
- <div
982
- #annotation
983
- ngtsHTMLContent
984
- style="display: none; background: #151520; color: white; padding: 6px 8px; border-radius: 7px; white-space: nowrap"
985
- [class]="pivotControls.annotationsClass()"
986
- ></div>
987
- </ngts-html>
988
- }
989
- <ngt-group [position]="[pos1() * 1.7, pos1() * 1.7, 0]">
990
- <ngt-mesh
991
- [visible]="true"
992
- [scale]="length()"
993
- [userData]="pivotControls.userData()"
994
- (pointerdown)="onPointerDown($any($event))"
995
- (pointermove)="onPointerMove($any($event))"
996
- (pointerup)="onPointerUp($any($event))"
997
- (pointerout)="onPointerOut($any($event))"
998
- >
999
- <ngt-plane-geometry />
1000
- <ngt-mesh-basic-material
1001
- [transparent]="true"
1002
- [depthTest]="pivotControls.depthTest()"
1003
- [color]="color()"
1004
- [polygonOffset]="true"
1005
- [polygonOffsetFactor]="-10"
1006
- [side]="DoubleSide"
1007
- [fog]="false"
1008
- />
1009
- </ngt-mesh>
1010
- <ngts-line
1011
- [points]="points()"
1012
- [options]="{
1013
- position: [-length() / 2, -length() / 2, 0],
1014
- transparent: true,
1015
- depthTest: pivotControls.depthTest(),
1016
- lineWidth: pivotControls.lineWidth(),
1017
- color: color(),
1018
- opacity: pivotControls.opacity(),
1019
- polygonOffset: true,
1020
- polygonOffsetFactor: -10,
1021
- userData: pivotControls.userData(),
1022
- fog: false,
1023
- }"
1024
- />
1025
- </ngt-group>
1026
- </ngt-group>
1027
- `,
1028
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
1029
- changeDetection: ChangeDetectionStrategy.OnPush,
1030
- imports: [NgtsHTML, NgtsHTMLContent, NgtsLine],
1031
- }]
1032
- }], ctorParameters: () => [] });
1033
-
1034
- const vec1 = new Vector3();
1035
- const vec2 = new Vector3();
1036
- function calculateOffset(clickPoint, normal, rayStart, rayDir) {
1037
- const e1 = normal.dot(normal);
1038
- const e2 = normal.dot(clickPoint) - normal.dot(rayStart);
1039
- const e3 = normal.dot(rayDir);
1040
- if (e3 === 0) {
1041
- return -e2 / e1;
1042
- }
1043
- vec1
1044
- .copy(rayDir)
1045
- .multiplyScalar(e1 / e3)
1046
- .sub(normal);
1047
- vec2
1048
- .copy(rayDir)
1049
- .multiplyScalar(e2 / e3)
1050
- .add(rayStart)
1051
- .sub(clickPoint);
1052
- return -vec1.dot(vec2) / vec1.dot(vec1);
1053
- }
1054
- const upV = new Vector3(0, 1, 0);
1055
- const scaleV = new Vector3();
1056
- const scaleMatrix = new Matrix4();
1057
- class NgtsScalingSphere {
1058
- constructor() {
1059
- this.direction = input.required();
1060
- this.axis = input.required();
1061
- this.groupRef = viewChild.required('group');
1062
- this.annotationRef = viewChild('annotation', { read: ElementRef });
1063
- this.meshRef = viewChild.required('mesh');
1064
- this.pivotControls = inject(NgtsPivotControls);
1065
- this.store = injectStore();
1066
- this.controls = this.store.select('controls');
1067
- this.size = this.store.select('size');
1068
- this.hovered = signal(false);
1069
- this.scale0 = 1;
1070
- this.scaleCurrent = 1;
1071
- this.clickInfo = null;
1072
- this.position = computed(() => (this.pivotControls.fixed() ? 1.2 : 1.2 * this.pivotControls.scale()));
1073
- this.radius = computed(() => this.pivotControls.fixed()
1074
- ? (this.pivotControls.lineWidth() / this.pivotControls.scale()) * 1.8
1075
- : this.pivotControls.scale() / 22.5);
1076
- this.matrixL = computed(() => {
1077
- const quaternion = new Quaternion().setFromUnitVectors(upV, this.direction().clone().normalize());
1078
- return new Matrix4().makeRotationFromQuaternion(quaternion);
1079
- });
1080
- this.color = computed(() => this.hovered() ? this.pivotControls.hoveredColor() : this.pivotControls.axisColors()[this.axis()]);
1081
- extend({ Group, Mesh, SphereGeometry, MeshBasicMaterial });
1082
- }
1083
- onPointerDown(event) {
1084
- const [annotation, controls, fixed, scale, direction, axis, size, group] = [
1085
- this.annotationRef()?.nativeElement,
1086
- this.controls(),
1087
- this.pivotControls.fixed(),
1088
- this.pivotControls.scale(),
1089
- this.direction(),
1090
- this.axis(),
1091
- this.size(),
1092
- this.groupRef().nativeElement,
1093
- ];
1094
- if (annotation) {
1095
- annotation.innerText = `${scale.toFixed(2)}`;
1096
- annotation.style.display = 'block';
1097
- }
1098
- event.stopPropagation();
1099
- const rotation = new Matrix4().extractRotation(group.matrixWorld);
1100
- const clickPoint = event.point.clone();
1101
- const origin = new Vector3().setFromMatrixPosition(group.matrixWorld);
1102
- const dir = direction.clone().applyMatrix4(rotation).normalize();
1103
- const mPLG = group.matrixWorld.clone();
1104
- const mPLGInv = mPLG.clone().invert();
1105
- const offsetMultiplier = fixed
1106
- ? 1 / calculateScaleFactor(group.getWorldPosition(vec1), scale, event.camera, size)
1107
- : 1;
1108
- this.clickInfo = { clickPoint, dir, mPLG, mPLGInv, offsetMultiplier };
1109
- this.pivotControls.onDragStart({ component: 'Sphere', axis, origin, directions: [dir] });
1110
- if (controls) {
1111
- controls.enabled = false;
1112
- }
1113
- // @ts-expect-error - setPointerCapture is not in the type definition
1114
- event.target.setPointerCapture(event.pointerId);
1115
- }
1116
- onPointerMove(event) {
1117
- event.stopPropagation();
1118
- if (!this.hovered())
1119
- this.hovered.set(true);
1120
- if (this.clickInfo) {
1121
- const { clickPoint, dir, mPLG, mPLGInv, offsetMultiplier } = this.clickInfo;
1122
- const [scaleLimits, axis, position, annotation, fixed, scale, mesh] = [
1123
- this.pivotControls.scaleLimits(),
1124
- this.axis(),
1125
- this.position(),
1126
- this.annotationRef()?.nativeElement,
1127
- this.pivotControls.fixed(),
1128
- this.pivotControls.scale(),
1129
- this.meshRef().nativeElement,
1130
- ];
1131
- const [min, max] = scaleLimits?.[axis] || [1e-5, undefined]; // always limit the minimal value, since setting it very low might break the transform
1132
- const offsetW = calculateOffset(clickPoint, dir, event.ray.origin, event.ray.direction);
1133
- const offsetL = offsetW * offsetMultiplier;
1134
- const offsetH = fixed ? offsetL : offsetL / scale;
1135
- let upscale = Math.pow(2, offsetH * 0.2);
1136
- if (event.shiftKey) {
1137
- upscale = Math.round(upscale * 10) / 10;
1138
- }
1139
- upscale = Math.max(upscale, min / this.scale0);
1140
- if (max !== undefined) {
1141
- upscale = Math.min(upscale, max / this.scale0);
1142
- }
1143
- this.scaleCurrent = this.scale0 * upscale;
1144
- mesh.position.set(0, position + offsetL, 0);
1145
- if (annotation) {
1146
- annotation.innerText = `${this.scaleCurrent.toFixed(2)}`;
1147
- }
1148
- scaleV.set(1, 1, 1);
1149
- scaleV.setComponent(axis, upscale);
1150
- scaleMatrix.makeScale(scaleV.x, scaleV.y, scaleV.z).premultiply(mPLG).multiply(mPLGInv);
1151
- this.pivotControls.onDrag(scaleMatrix);
1152
- }
1153
- }
1154
- onPointerUp(event) {
1155
- const [annotation, controls, position, mesh] = [
1156
- this.annotationRef()?.nativeElement,
1157
- this.controls(),
1158
- this.position(),
1159
- this.meshRef().nativeElement,
1160
- ];
1161
- if (annotation) {
1162
- annotation.style.display = 'none';
1163
- }
1164
- event.stopPropagation();
1165
- this.scale0 = this.scaleCurrent;
1166
- this.clickInfo = null;
1167
- mesh.position.set(0, position, 0);
1168
- this.pivotControls.onDragEnd();
1169
- if (controls) {
1170
- controls.enabled = true;
1171
- }
1172
- // @ts-expect-error - releasePointerCapture is not in the type definition
1173
- event.target.releasePointerCapture(event.pointerId);
1174
- }
1175
- onPointerOut(event) {
1176
- event.stopPropagation();
1177
- this.hovered.set(false);
1178
- }
1179
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsScalingSphere, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1180
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: NgtsScalingSphere, isStandalone: true, selector: "ngts-scaling-sphere", inputs: { direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: true, transformFunction: null }, axis: { classPropertyName: "axis", publicName: "axis", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "groupRef", first: true, predicate: ["group"], descendants: true, isSignal: true }, { propertyName: "annotationRef", first: true, predicate: ["annotation"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "meshRef", first: true, predicate: ["mesh"], descendants: true, isSignal: true }], ngImport: i0, template: `
1181
- <ngt-group #group>
1182
- <ngt-group
1183
- [matrix]="matrixL()"
1184
- [matrixAutoUpdate]="false"
1185
- (pointerdown)="onPointerDown($any($event))"
1186
- (pointermove)="onPointerMove($any($event))"
1187
- (pointerup)="onPointerUp($any($event))"
1188
- (pointerout)="onPointerOut($any($event))"
1189
- >
1190
- @if (pivotControls.annotations()) {
1191
- <ngts-html [options]="{ position: [0, position() / 2, 0] }">
1192
- <div
1193
- #annotation
1194
- ngtsHTMLContent
1195
- style="display: none; background: #151520; color: white; padding: 6px 8px; border-radius: 7px; white-space: nowrap;"
1196
- [class]="pivotControls.annotationsClass()"
1197
- ></div>
1198
- </ngts-html>
1199
- }
1200
- <ngt-mesh #mesh [position]="[0, position(), 0]" [renderOrder]="500" [userData]="pivotControls.userData()">
1201
- <ngt-sphere-geometry *args="[radius(), 12, 12]" />
1202
- <ngt-mesh-basic-material
1203
- [transparent]="true"
1204
- [depthTest]="pivotControls.depthTest()"
1205
- [color]="color()"
1206
- [opacity]="pivotControls.opacity()"
1207
- [polygonOffset]="true"
1208
- [polygonOffsetFactor]="-10"
1209
- />
1210
- </ngt-mesh>
1211
- </ngt-group>
1212
- </ngt-group>
1213
- `, isInline: true, dependencies: [{ kind: "component", type: NgtsHTML, selector: "ngts-html", inputs: ["options"] }, { kind: "component", type: NgtsHTMLContent, selector: "[ngtsHTMLContent]", inputs: ["ngtsHTMLContent"], outputs: ["occluded"] }, { kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1214
- }
1215
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsScalingSphere, decorators: [{
1216
- type: Component,
1217
- args: [{
1218
- selector: 'ngts-scaling-sphere',
1219
- standalone: true,
1220
- template: `
1221
- <ngt-group #group>
1222
- <ngt-group
1223
- [matrix]="matrixL()"
1224
- [matrixAutoUpdate]="false"
1225
- (pointerdown)="onPointerDown($any($event))"
1226
- (pointermove)="onPointerMove($any($event))"
1227
- (pointerup)="onPointerUp($any($event))"
1228
- (pointerout)="onPointerOut($any($event))"
1229
- >
1230
- @if (pivotControls.annotations()) {
1231
- <ngts-html [options]="{ position: [0, position() / 2, 0] }">
1232
- <div
1233
- #annotation
1234
- ngtsHTMLContent
1235
- style="display: none; background: #151520; color: white; padding: 6px 8px; border-radius: 7px; white-space: nowrap;"
1236
- [class]="pivotControls.annotationsClass()"
1237
- ></div>
1238
- </ngts-html>
1239
- }
1240
- <ngt-mesh #mesh [position]="[0, position(), 0]" [renderOrder]="500" [userData]="pivotControls.userData()">
1241
- <ngt-sphere-geometry *args="[radius(), 12, 12]" />
1242
- <ngt-mesh-basic-material
1243
- [transparent]="true"
1244
- [depthTest]="pivotControls.depthTest()"
1245
- [color]="color()"
1246
- [opacity]="pivotControls.opacity()"
1247
- [polygonOffset]="true"
1248
- [polygonOffsetFactor]="-10"
1249
- />
1250
- </ngt-mesh>
1251
- </ngt-group>
1252
- </ngt-group>
1253
- `,
1254
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
1255
- changeDetection: ChangeDetectionStrategy.OnPush,
1256
- imports: [NgtsHTML, NgtsHTMLContent, NgtArgs],
1257
- }]
1258
- }], ctorParameters: () => [] });
1259
-
1260
- const mL0 = new Matrix4();
1261
- const mW0 = new Matrix4();
1262
- const mP = new Matrix4();
1263
- const mPInv = new Matrix4();
1264
- const mW = new Matrix4();
1265
- const mL = new Matrix4();
1266
- const mL0Inv = new Matrix4();
1267
- const mdL = new Matrix4();
1268
- const mG = new Matrix4();
1269
- const bb = new Box3();
1270
- const bbObj = new Box3();
1271
- const vCenter = new Vector3();
1272
- const vSize = new Vector3();
1273
- const vAnchorOffset = new Vector3();
1274
- const vPosition = new Vector3();
1275
- const vScale = new Vector3();
1276
- const xDir = new Vector3(1, 0, 0);
1277
- const yDir = new Vector3(0, 1, 0);
1278
- const zDir = new Vector3(0, 0, 1);
1279
- const defaultOptions$1 = {
1280
- enabled: true,
1281
- autoTransform: true,
1282
- disableAxes: false,
1283
- disableSliders: false,
1284
- disableRotations: false,
1285
- disableScaling: false,
1286
- activeAxes: [true, true, true],
1287
- offset: [0, 0, 0],
1288
- rotation: [0, 0, 0],
1289
- scale: 1,
1290
- lineWidth: 4,
1291
- fixed: false,
1292
- depthTest: true,
1293
- axisColors: ['#ff2060', '#20df80', '#2080ff'],
1294
- hoveredColor: '#ffff40',
1295
- annotations: false,
1296
- opacity: 1,
1297
- visible: true,
1298
- };
1299
- class NgtsPivotControls {
1300
- constructor() {
1301
- this.options = input(defaultOptions$1, { transform: mergeInputs(defaultOptions$1) });
1302
- this.parameters = omit(this.options, [
1303
- 'enabled',
1304
- 'matrix',
1305
- 'autoTransform',
1306
- 'anchor',
1307
- 'disableAxes',
1308
- 'disableSliders',
1309
- 'disableRotations',
1310
- 'disableScaling',
1311
- 'activeAxes',
1312
- 'offset',
1313
- 'rotation',
1314
- 'scale',
1315
- 'lineWidth',
1316
- 'fixed',
1317
- 'translationLimits',
1318
- 'rotationLimits',
1319
- 'scaleLimits',
1320
- 'depthTest',
1321
- 'axisColors',
1322
- 'hoveredColor',
1323
- 'annotations',
1324
- 'annotationsClass',
1325
- 'opacity',
1326
- 'visible',
1327
- 'userData',
1328
- ]);
1329
- this.dragStarted = output();
1330
- this.dragEnded = output();
1331
- this.dragged = output();
1332
- this.matrix = pick(this.options, 'matrix');
1333
- this.annotations = pick(this.options, 'annotations');
1334
- this.annotationsClass = pick(this.options, 'annotationsClass');
1335
- this.translationLimits = pick(this.options, 'translationLimits');
1336
- this.rotationLimits = pick(this.options, 'rotationLimits');
1337
- this.scaleLimits = pick(this.options, 'scaleLimits');
1338
- this.autoTransform = pick(this.options, 'autoTransform');
1339
- this.fixed = pick(this.options, 'fixed');
1340
- this.hoveredColor = pick(this.options, 'hoveredColor');
1341
- this.axisColors = pick(this.options, 'axisColors');
1342
- this.lineWidth = pick(this.options, 'lineWidth');
1343
- this.scale = pick(this.options, 'scale');
1344
- this.userData = pick(this.options, 'userData');
1345
- this.opacity = pick(this.options, 'opacity');
1346
- this.depthTest = pick(this.options, 'depthTest');
1347
- this.offset = pick(this.options, 'offset');
1348
- this.rotation = pick(this.options, 'rotation');
1349
- this.visible = pick(this.options, 'visible');
1350
- this.enabled = pick(this.options, 'enabled');
1351
- this.disableAxes = pick(this.options, 'disableAxes');
1352
- this.disableSliders = pick(this.options, 'disableSliders');
1353
- this.disableRotations = pick(this.options, 'disableRotations');
1354
- this.disableScaling = pick(this.options, 'disableScaling');
1355
- this.activeAxes = pick(this.options, 'activeAxes');
1356
- this.xDir = xDir;
1357
- this.yDir = yDir;
1358
- this.zDir = zDir;
1359
- this.parentRef = viewChild.required('parent');
1360
- this.groupRef = viewChild.required('group');
1361
- this.gizmoRef = viewChild.required('gizmo');
1362
- this.childrenRef = viewChild.required('children');
1363
- this.store = injectStore();
1364
- this.invalidate = this.store.select('invalidate');
1365
- this.translation = [0, 0, 0];
1366
- this.anchor = pick(this.options, 'anchor');
1367
- this.cameraScale = new Vector3(1, 1, 1);
1368
- this.gizmoScale = new Vector3(1, 1, 1);
1369
- extend({ Group });
1370
- const autoEffect = injectAutoEffect();
1371
- afterNextRender(() => {
1372
- autoEffect(() => {
1373
- const anchor = this.anchor();
1374
- if (!anchor)
1375
- return;
1376
- const children = this.childrenRef().nativeElement;
1377
- const localState = getLocalState(children);
1378
- if (!localState)
1379
- return;
1380
- const [gizmo, offset, invalidate] = [
1381
- this.gizmoRef().nativeElement,
1382
- this.offset(),
1383
- this.invalidate(),
1384
- this.options(),
1385
- localState.objects(),
1386
- ];
1387
- children.updateWorldMatrix(true, true);
1388
- mPInv.copy(children.matrixWorld).invert();
1389
- bb.makeEmpty();
1390
- children.traverse((obj) => {
1391
- if (!obj.geometry)
1392
- return;
1393
- if (!obj.geometry.boundingBox)
1394
- obj.geometry.computeBoundingBox();
1395
- mL.copy(obj.matrixWorld).premultiply(mPInv);
1396
- const boundingBox = obj.geometry.boundingBox;
1397
- if (boundingBox) {
1398
- bbObj.copy(boundingBox);
1399
- bbObj.applyMatrix4(mL);
1400
- bb.union(bbObj);
1401
- }
1402
- });
1403
- vCenter.copy(bb.max).add(bb.min).multiplyScalar(0.5);
1404
- vSize.copy(bb.max).sub(bb.min).multiplyScalar(0.5);
1405
- vAnchorOffset
1406
- .copy(vSize)
1407
- .multiply(new Vector3(...anchor))
1408
- .add(vCenter);
1409
- vPosition.set(...offset).add(vAnchorOffset);
1410
- gizmo.position.copy(vPosition);
1411
- invalidate();
1412
- });
1413
- });
1414
- const vec = new Vector3();
1415
- injectBeforeRender(({ camera, size, invalidate }) => {
1416
- const [{ fixed, scale, matrix }, gizmo, group] = [
1417
- this.options(),
1418
- this.gizmoRef().nativeElement,
1419
- this.groupRef().nativeElement,
1420
- ];
1421
- if (fixed) {
1422
- const sf = calculateScaleFactor(gizmo.getWorldPosition(vec), scale, camera, size);
1423
- this.cameraScale.setScalar(sf);
1424
- }
1425
- if (matrix && matrix instanceof Matrix4) {
1426
- group.matrix = matrix;
1427
- }
1428
- // Update gizmo scale in accordance with matrix changes
1429
- // Without this, there might be noticeable turbulence if scaling happens fast enough
1430
- gizmo.updateWorldMatrix(true, true);
1431
- mG.makeRotationFromEuler(gizmo.rotation).setPosition(gizmo.position).premultiply(group.matrixWorld);
1432
- this.gizmoScale.setFromMatrixScale(mG);
1433
- vScale.copy(this.cameraScale).divide(this.gizmoScale);
1434
- if (Math.abs(gizmo.scale.x - vScale.x) > 1e-4 ||
1435
- Math.abs(gizmo.scale.y - vScale.y) > 1e-4 ||
1436
- Math.abs(gizmo.scale.z - vScale.z) > 1e-4) {
1437
- gizmo.scale.copy(vScale);
1438
- invalidate();
1439
- }
1440
- });
1441
- }
1442
- onDragStart(parameters) {
1443
- const group = this.groupRef().nativeElement;
1444
- mL0.copy(group.matrix);
1445
- mW0.copy(group.matrixWorld);
1446
- this.dragStarted.emit(parameters);
1447
- this.store.snapshot.invalidate();
1448
- }
1449
- onDrag(mdW) {
1450
- const [parent, group, autoTransform] = [
1451
- this.parentRef().nativeElement,
1452
- this.groupRef().nativeElement,
1453
- this.autoTransform(),
1454
- ];
1455
- mP.copy(parent.matrixWorld);
1456
- mPInv.copy(mP).invert();
1457
- // After applying the delta
1458
- mW.copy(mW0).premultiply(mdW);
1459
- mL.copy(mW).premultiply(mPInv);
1460
- mL0Inv.copy(mL0).invert();
1461
- mdL.copy(mL).multiply(mL0Inv);
1462
- if (autoTransform) {
1463
- group.matrix.copy(mL);
1464
- }
1465
- this.dragged.emit({ l: mL, deltaL: mdL, w: mW, deltaW: mdW });
1466
- this.store.snapshot.invalidate();
1467
- }
1468
- onDragEnd() {
1469
- this.dragEnded.emit();
1470
- this.store.snapshot.invalidate();
1471
- }
1472
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsPivotControls, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1473
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: NgtsPivotControls, isStandalone: true, selector: "ngts-pivot-controls", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dragStarted: "dragStarted", dragEnded: "dragEnded", dragged: "dragged" }, viewQueries: [{ propertyName: "parentRef", first: true, predicate: ["parent"], descendants: true, isSignal: true }, { propertyName: "groupRef", first: true, predicate: ["group"], descendants: true, isSignal: true }, { propertyName: "gizmoRef", first: true, predicate: ["gizmo"], descendants: true, isSignal: true }, { propertyName: "childrenRef", first: true, predicate: ["children"], descendants: true, isSignal: true }], ngImport: i0, template: `
1474
- <ngt-group #parent>
1475
- <ngt-group #group [matrix]="matrix()" [matrixAutoUpdate]="false" [parameters]="parameters()">
1476
- <ngt-group #gizmo [visible]="visible()" [position]="offset()" [rotation]="rotation()">
1477
- @if (enabled()) {
1478
- @if (!disableAxes() && activeAxes()[0]) {
1479
- <ngts-axis-arrow [axis]="0" [direction]="xDir" />
1480
- }
1481
- @if (!disableAxes() && activeAxes()[1]) {
1482
- <ngts-axis-arrow [axis]="1" [direction]="yDir" />
1483
- }
1484
- @if (!disableAxes() && activeAxes()[2]) {
1485
- <ngts-axis-arrow [axis]="2" [direction]="zDir" />
1486
- }
1487
-
1488
- @if (!disableSliders() && activeAxes()[0] && activeAxes()[1]) {
1489
- <ngts-plane-slider [axis]="2" [dir1]="xDir" [dir2]="yDir" />
1490
- }
1491
- @if (!disableSliders() && activeAxes()[0] && activeAxes()[2]) {
1492
- <ngts-plane-slider [axis]="1" [dir1]="zDir" [dir2]="xDir" />
1493
- }
1494
- @if (!disableSliders() && activeAxes()[2] && activeAxes()[1]) {
1495
- <ngts-plane-slider [axis]="0" [dir1]="yDir" [dir2]="zDir" />
1496
- }
1497
-
1498
- @if (!disableRotations() && activeAxes()[0] && activeAxes()[1]) {
1499
- <ngts-axis-rotator [axis]="2" [dir1]="xDir" [dir2]="yDir" />
1500
- }
1501
- @if (!disableRotations() && activeAxes()[0] && activeAxes()[2]) {
1502
- <ngts-axis-rotator [axis]="1" [dir1]="zDir" [dir2]="xDir" />
1503
- }
1504
- @if (!disableRotations() && activeAxes()[2] && activeAxes()[1]) {
1505
- <ngts-axis-rotator [axis]="0" [dir1]="yDir" [dir2]="zDir" />
1506
- }
1507
-
1508
- @if (!disableScaling() && activeAxes()[0]) {
1509
- <ngts-scaling-sphere [axis]="0" [direction]="xDir" />
1510
- }
1511
- @if (!disableScaling() && activeAxes()[1]) {
1512
- <ngts-scaling-sphere [axis]="1" [direction]="yDir" />
1513
- }
1514
- @if (!disableScaling() && activeAxes()[2]) {
1515
- <ngts-scaling-sphere [axis]="2" [direction]="zDir" />
1516
- }
1517
- }
1518
- </ngt-group>
1519
- <ngt-group #children>
1520
- <ng-content />
1521
- </ngt-group>
1522
- </ngt-group>
1523
- </ngt-group>
1524
- `, isInline: true, dependencies: [{ kind: "component", type: NgtsAxisArrow, selector: "ngts-axis-arrow", inputs: ["direction", "axis"] }, { kind: "component", type: NgtsPlaneSlider, selector: "ngts-plane-slider", inputs: ["dir1", "dir2", "axis"] }, { kind: "component", type: NgtsAxisRotator, selector: "ngts-axis-rotator", inputs: ["dir1", "dir2", "axis"] }, { kind: "component", type: NgtsScalingSphere, selector: "ngts-scaling-sphere", inputs: ["direction", "axis"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1525
- }
1526
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsPivotControls, decorators: [{
1527
- type: Component,
1528
- args: [{
1529
- selector: 'ngts-pivot-controls',
1530
- standalone: true,
1531
- template: `
1532
- <ngt-group #parent>
1533
- <ngt-group #group [matrix]="matrix()" [matrixAutoUpdate]="false" [parameters]="parameters()">
1534
- <ngt-group #gizmo [visible]="visible()" [position]="offset()" [rotation]="rotation()">
1535
- @if (enabled()) {
1536
- @if (!disableAxes() && activeAxes()[0]) {
1537
- <ngts-axis-arrow [axis]="0" [direction]="xDir" />
1538
- }
1539
- @if (!disableAxes() && activeAxes()[1]) {
1540
- <ngts-axis-arrow [axis]="1" [direction]="yDir" />
1541
- }
1542
- @if (!disableAxes() && activeAxes()[2]) {
1543
- <ngts-axis-arrow [axis]="2" [direction]="zDir" />
1544
- }
1545
-
1546
- @if (!disableSliders() && activeAxes()[0] && activeAxes()[1]) {
1547
- <ngts-plane-slider [axis]="2" [dir1]="xDir" [dir2]="yDir" />
1548
- }
1549
- @if (!disableSliders() && activeAxes()[0] && activeAxes()[2]) {
1550
- <ngts-plane-slider [axis]="1" [dir1]="zDir" [dir2]="xDir" />
1551
- }
1552
- @if (!disableSliders() && activeAxes()[2] && activeAxes()[1]) {
1553
- <ngts-plane-slider [axis]="0" [dir1]="yDir" [dir2]="zDir" />
1554
- }
1555
-
1556
- @if (!disableRotations() && activeAxes()[0] && activeAxes()[1]) {
1557
- <ngts-axis-rotator [axis]="2" [dir1]="xDir" [dir2]="yDir" />
1558
- }
1559
- @if (!disableRotations() && activeAxes()[0] && activeAxes()[2]) {
1560
- <ngts-axis-rotator [axis]="1" [dir1]="zDir" [dir2]="xDir" />
1561
- }
1562
- @if (!disableRotations() && activeAxes()[2] && activeAxes()[1]) {
1563
- <ngts-axis-rotator [axis]="0" [dir1]="yDir" [dir2]="zDir" />
1564
- }
1565
-
1566
- @if (!disableScaling() && activeAxes()[0]) {
1567
- <ngts-scaling-sphere [axis]="0" [direction]="xDir" />
1568
- }
1569
- @if (!disableScaling() && activeAxes()[1]) {
1570
- <ngts-scaling-sphere [axis]="1" [direction]="yDir" />
1571
- }
1572
- @if (!disableScaling() && activeAxes()[2]) {
1573
- <ngts-scaling-sphere [axis]="2" [direction]="zDir" />
1574
- }
1575
- }
1576
- </ngt-group>
1577
- <ngt-group #children>
1578
- <ng-content />
1579
- </ngt-group>
1580
- </ngt-group>
1581
- </ngt-group>
1582
- `,
1583
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
1584
- changeDetection: ChangeDetectionStrategy.OnPush,
1585
- imports: [NgtsAxisArrow, NgtsPlaneSlider, NgtsAxisRotator, NgtsScalingSphere],
1586
- }]
1587
- }], ctorParameters: () => [] });
1588
-
1589
261
  const defaultOptions = {
1590
262
  eps: 0.00001,
1591
263
  horizontal: false,
@@ -1847,6 +519,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
1847
519
  }]
1848
520
  }], ctorParameters: () => [] });
1849
521
 
522
+ /**
523
+ * @deprecated Use `NgtsPivotControls` from `angular-three-soba/gizmos` instead.
524
+ */
525
+ const NgtsPivotControls = NgtsPivotControls$1;
526
+
1850
527
  /**
1851
528
  * Generated bundle index. Do not edit.
1852
529
  */