angular-three-soba 3.7.0 → 4.0.0-next.2
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.
- package/abstractions/lib/billboard.d.ts +6 -6
- package/abstractions/lib/catmull-rom-line.d.ts +155 -545
- package/abstractions/lib/cubic-bezier-line.d.ts +7 -7
- package/abstractions/lib/edges.d.ts +153 -729
- package/abstractions/lib/gradient-texture.d.ts +8 -8
- package/abstractions/lib/grid.d.ts +24 -292
- package/abstractions/lib/helper.d.ts +5 -5
- package/abstractions/lib/line.d.ts +11 -12
- package/abstractions/lib/prism-geometry.d.ts +8 -8
- package/abstractions/lib/quadratic-bezier-line.d.ts +7 -7
- package/abstractions/lib/rounded-box.d.ts +8 -8
- package/abstractions/lib/text-3d.d.ts +8 -287
- package/abstractions/lib/text.d.ts +12 -13
- package/cameras/lib/camera-content.d.ts +2 -2
- package/cameras/lib/cube-camera.d.ts +12 -12
- package/cameras/lib/orthographic-camera.d.ts +10 -10
- package/cameras/lib/perspective-camera.d.ts +9 -9
- package/controls/lib/camera-controls.d.ts +1 -6
- package/controls/lib/orbit-controls.d.ts +6 -10
- package/controls/lib/scroll-controls.d.ts +8 -14
- package/fesm2022/angular-three-soba-abstractions.mjs +75 -52
- package/fesm2022/angular-three-soba-abstractions.mjs.map +1 -1
- package/fesm2022/angular-three-soba-cameras.mjs +18 -20
- package/fesm2022/angular-three-soba-cameras.mjs.map +1 -1
- package/fesm2022/angular-three-soba-controls.mjs +65 -65
- package/fesm2022/angular-three-soba-controls.mjs.map +1 -1
- package/fesm2022/angular-three-soba-gizmos.mjs +185 -194
- package/fesm2022/angular-three-soba-gizmos.mjs.map +1 -1
- package/fesm2022/angular-three-soba-loaders.mjs +21 -16
- package/fesm2022/angular-three-soba-loaders.mjs.map +1 -1
- package/fesm2022/angular-three-soba-materials.mjs +90 -93
- package/fesm2022/angular-three-soba-materials.mjs.map +1 -1
- package/fesm2022/angular-three-soba-misc.mjs +282 -279
- package/fesm2022/angular-three-soba-misc.mjs.map +1 -1
- package/fesm2022/angular-three-soba-performances.mjs +51 -56
- package/fesm2022/angular-three-soba-performances.mjs.map +1 -1
- package/fesm2022/angular-three-soba-shaders.mjs +5 -6
- package/fesm2022/angular-three-soba-shaders.mjs.map +1 -1
- package/fesm2022/angular-three-soba-staging.mjs +253 -277
- package/fesm2022/angular-three-soba-staging.mjs.map +1 -1
- package/fesm2022/angular-three-soba-stats.mjs +3 -4
- package/fesm2022/angular-three-soba-stats.mjs.map +1 -1
- package/gizmos/lib/gizmo-helper/gizmo-helper.d.ts +12 -15
- package/gizmos/lib/gizmo-helper/gizmo-viewcube.d.ts +5 -6
- package/gizmos/lib/gizmo-helper/gizmo-viewport.d.ts +8 -9
- package/gizmos/lib/pivot-controls/axis-arrow.d.ts +11 -13
- package/gizmos/lib/pivot-controls/axis-rotator.d.ts +11 -12
- package/gizmos/lib/pivot-controls/pivot-controls.d.ts +28 -29
- package/gizmos/lib/pivot-controls/plane-slider.d.ts +12 -13
- package/gizmos/lib/pivot-controls/scaling-sphere.d.ts +12 -14
- package/gizmos/lib/transform-controls.d.ts +15 -20
- package/loaders/lib/loader.d.ts +10 -11
- package/loaders/lib/texture-loader.d.ts +3 -3
- package/materials/lib/custom-shader-material.d.ts +2 -2
- package/materials/lib/mesh-distort-material.d.ts +3 -3
- package/materials/lib/mesh-portal-material.d.ts +19 -118
- package/materials/lib/mesh-reflector-material.d.ts +4 -5
- package/materials/lib/mesh-refraction-material.d.ts +13 -14
- package/materials/lib/mesh-transmission-material.d.ts +14 -14
- package/materials/lib/mesh-wobble-material.d.ts +4 -4
- package/materials/lib/point-material.d.ts +3 -3
- package/misc/lib/animations.d.ts +12 -12
- package/misc/lib/computed-attribute.d.ts +5 -48
- package/misc/lib/decal.d.ts +9 -9
- package/misc/lib/deprecated.d.ts +2 -2
- package/misc/lib/depth-buffer.d.ts +2 -2
- package/misc/lib/fbo.d.ts +9 -9
- package/misc/lib/html/html-content.d.ts +5 -7
- package/misc/lib/html/html.d.ts +15 -14
- package/misc/lib/html/utils.d.ts +9 -9
- package/misc/lib/intersect.d.ts +2 -2
- package/misc/lib/preload.d.ts +3 -6
- package/misc/lib/sampler.d.ts +22 -21
- package/misc/lib/scale-factor.d.ts +2 -2
- package/package.json +23 -23
- package/performances/lib/detailed.d.ts +5 -5
- package/performances/lib/instances/instances.d.ts +8 -96
- package/performances/lib/instances/position-mesh.d.ts +8 -8
- package/performances/lib/points/points.d.ts +9 -187
- package/performances/lib/points/position-point.d.ts +8 -8
- package/performances/lib/segments/segment-object.d.ts +6 -6
- package/performances/lib/segments/segments.d.ts +44 -45
- package/shaders/lib/grid-material.d.ts +16 -16
- package/shaders/lib/point-material.d.ts +5 -5
- package/staging/lib/accumulative-shadows.d.ts +21 -25
- package/staging/lib/backdrop.d.ts +8 -8
- package/staging/lib/bb-anchor.d.ts +5 -5
- package/staging/lib/bounds.d.ts +13 -17
- package/staging/lib/camera-shake.d.ts +0 -2
- package/staging/lib/caustics.d.ts +11 -11
- package/staging/lib/center.d.ts +10 -350
- package/staging/lib/contact-shadows.d.ts +17 -16
- package/staging/lib/environment/environment.d.ts +13 -15
- package/staging/lib/environment/inject-environment.d.ts +3 -3
- package/staging/lib/float.d.ts +5 -5
- package/staging/lib/lightformer.d.ts +11 -290
- package/staging/lib/mask.d.ts +8 -10
- package/staging/lib/matcap-texture.d.ts +5 -5
- package/staging/lib/normal-texture.d.ts +5 -5
- package/staging/lib/randomized-lights.d.ts +13 -13
- package/staging/lib/render-texture.d.ts +21 -17
- package/staging/lib/sky.d.ts +13 -13
- package/staging/lib/spot-light.d.ts +39 -39
- package/staging/lib/stage.d.ts +107 -277
- package/vanilla-exports/index.d.ts +6 -7
- package/metadata.json +0 -1
- package/web-types.json +0 -1
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { NgTemplateOutlet, DOCUMENT } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { Directive, input, output, contentChild, TemplateRef, viewChild, computed, effect, Component, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, inject, signal, ElementRef } from '@angular/core';
|
|
4
|
-
import { pick, injectStore, extend, injectBeforeRender, hasListener, NgtPortal, NgtPortalContent, NgtArgs, getEmitter, omit,
|
|
4
|
+
import { pick, injectStore, extend, injectBeforeRender, hasListener, NgtPortal, NgtPortalAutoRender, NgtPortalContent, NgtArgs, getEmitter, omit, getInstanceState, is, resolveRef } from 'angular-three';
|
|
5
5
|
import { NgtsOrthographicCamera } from 'angular-three-soba/cameras';
|
|
6
6
|
import { mergeInputs } from 'ngxtension/inject-inputs';
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
7
|
+
import * as THREE from 'three';
|
|
8
|
+
import { Group, MeshBasicMaterial, Mesh, BoxGeometry, Sprite, SpriteMaterial, ConeGeometry, CylinderGeometry, PlaneGeometry, SphereGeometry } from 'three';
|
|
9
|
+
import * as i1 from 'angular-three-soba/misc';
|
|
10
|
+
import { NgtsHTMLDeclarations, calculateScaleFactor } from 'angular-three-soba/misc';
|
|
9
11
|
import { NgtsLine } from 'angular-three-soba/abstractions';
|
|
10
12
|
import { TransformControls } from 'three-stdlib';
|
|
11
13
|
|
|
12
14
|
const turnRate = 2 * Math.PI; // turn rate in angles per second
|
|
13
|
-
const dummy = new Object3D();
|
|
14
|
-
const matrix = new Matrix4();
|
|
15
|
-
const [q1, q2] = [new Quaternion(), new Quaternion()];
|
|
16
|
-
const target = new Vector3();
|
|
17
|
-
const targetPosition = new Vector3();
|
|
15
|
+
const dummy = new THREE.Object3D();
|
|
16
|
+
const matrix = new THREE.Matrix4();
|
|
17
|
+
const [q1, q2] = [new THREE.Quaternion(), new THREE.Quaternion()];
|
|
18
|
+
const target = new THREE.Vector3();
|
|
19
|
+
const targetPosition = new THREE.Vector3();
|
|
18
20
|
class NgtsGizmoHelperContent {
|
|
19
21
|
static ngTemplateContextGuard(_, ctx) {
|
|
20
22
|
return true;
|
|
@@ -38,33 +40,29 @@ class NgtsGizmoHelper {
|
|
|
38
40
|
this.renderPriority = pick(this.options, 'renderPriority');
|
|
39
41
|
this.margin = pick(this.options, 'margin');
|
|
40
42
|
this.alignment = pick(this.options, 'alignment');
|
|
41
|
-
this.scene = new Scene();
|
|
43
|
+
this.scene = new THREE.Scene();
|
|
42
44
|
this.content = contentChild.required(NgtsGizmoHelperContent, { read: TemplateRef });
|
|
43
45
|
this.gizmoRef = viewChild('gizmo');
|
|
44
46
|
this.virtualCameraRef = viewChild(NgtsOrthographicCamera);
|
|
45
47
|
this.store = injectStore();
|
|
46
|
-
this.size = this.store.select('size');
|
|
47
|
-
this.mainCamera = this.store.select('camera');
|
|
48
|
-
this.defaultControls = this.store.select('controls');
|
|
49
|
-
this.invalidate = this.store.select('invalidate');
|
|
50
48
|
this.x = computed(() => {
|
|
51
49
|
const alignment = this.alignment();
|
|
52
50
|
if (alignment.endsWith('-center'))
|
|
53
51
|
return 0;
|
|
54
|
-
const [
|
|
52
|
+
const [width, [marginX]] = [this.store.size.width(), this.margin()];
|
|
55
53
|
return alignment.endsWith('-left') ? -width / 2 + marginX : width / 2 - marginX;
|
|
56
54
|
});
|
|
57
55
|
this.y = computed(() => {
|
|
58
56
|
const alignment = this.alignment();
|
|
59
57
|
if (alignment.startsWith('center-'))
|
|
60
58
|
return 0;
|
|
61
|
-
const [
|
|
59
|
+
const [height, [marginY]] = [this.store.size.height(), this.margin()];
|
|
62
60
|
return alignment.startsWith('top-') ? height / 2 - marginY : -height / 2 + marginY;
|
|
63
61
|
});
|
|
64
62
|
this.animating = false;
|
|
65
63
|
this.radius = 0;
|
|
66
|
-
this.focusPoint = new Vector3(0, 0, 0);
|
|
67
|
-
this.defaultUp = new Vector3(0, 0, 0);
|
|
64
|
+
this.focusPoint = new THREE.Vector3(0, 0, 0);
|
|
65
|
+
this.defaultUp = new THREE.Vector3(0, 0, 0);
|
|
68
66
|
extend({ Group });
|
|
69
67
|
effect(() => {
|
|
70
68
|
this.updateDefaultUpEffect();
|
|
@@ -76,7 +74,11 @@ class NgtsGizmoHelper {
|
|
|
76
74
|
];
|
|
77
75
|
if (!virtualCamera || !gizmo)
|
|
78
76
|
return;
|
|
79
|
-
const [defaultControls, mainCamera, invalidate] = [
|
|
77
|
+
const [defaultControls, mainCamera, invalidate] = [
|
|
78
|
+
this.store.snapshot.controls,
|
|
79
|
+
this.store.snapshot.camera,
|
|
80
|
+
this.store.snapshot.invalidate,
|
|
81
|
+
];
|
|
80
82
|
// Animate step
|
|
81
83
|
if (this.animating) {
|
|
82
84
|
if (q1.angleTo(q2) < 0.01) {
|
|
@@ -112,7 +114,11 @@ class NgtsGizmoHelper {
|
|
|
112
114
|
});
|
|
113
115
|
}
|
|
114
116
|
tweenCamera(direction) {
|
|
115
|
-
const [defaultControls, invalidate, mainCamera] = [
|
|
117
|
+
const [defaultControls, invalidate, mainCamera] = [
|
|
118
|
+
this.store.snapshot.controls,
|
|
119
|
+
this.store.snapshot.invalidate,
|
|
120
|
+
this.store.snapshot.camera,
|
|
121
|
+
];
|
|
116
122
|
this.animating = true;
|
|
117
123
|
if (defaultControls) {
|
|
118
124
|
this.focusPoint = this.isCameraControls(defaultControls)
|
|
@@ -129,7 +135,7 @@ class NgtsGizmoHelper {
|
|
|
129
135
|
invalidate();
|
|
130
136
|
}
|
|
131
137
|
updateDefaultUpEffect() {
|
|
132
|
-
const mainCamera = this.
|
|
138
|
+
const mainCamera = this.store.camera();
|
|
133
139
|
this.defaultUp.copy(mainCamera.up);
|
|
134
140
|
}
|
|
135
141
|
isOrbitControls(controls) {
|
|
@@ -144,22 +150,21 @@ class NgtsGizmoHelper {
|
|
|
144
150
|
|
|
145
151
|
<ngt-portal
|
|
146
152
|
[container]="scene"
|
|
147
|
-
[autoRender]="
|
|
148
|
-
[autoRenderPriority]="_renderPriority"
|
|
153
|
+
[autoRender]="_renderPriority"
|
|
149
154
|
[state]="{ events: { priority: _renderPriority + 1 } }"
|
|
150
155
|
>
|
|
151
|
-
<ng-template portalContent let-injector="injector"
|
|
156
|
+
<ng-template portalContent let-injector="injector">
|
|
152
157
|
<ngts-orthographic-camera [options]="{ makeDefault: true, position: [0, 0, 200] }" />
|
|
153
158
|
<ngt-group #gizmo [position]="[x(), y(), 0]">
|
|
154
159
|
<ng-container
|
|
155
160
|
[ngTemplateOutlet]="content()"
|
|
156
|
-
[ngTemplateOutletContext]="{ container, injector }"
|
|
161
|
+
[ngTemplateOutletContext]="{ container: scene, injector }"
|
|
157
162
|
[ngTemplateOutletInjector]="injector"
|
|
158
163
|
/>
|
|
159
164
|
</ngt-group>
|
|
160
165
|
</ng-template>
|
|
161
166
|
</ngt-portal>
|
|
162
|
-
`, isInline: true, dependencies: [{ kind: "component", type: NgtPortal, selector: "ngt-portal", inputs: ["container", "state", "autoRender", "
|
|
167
|
+
`, isInline: true, dependencies: [{ kind: "component", type: NgtPortal, selector: "ngt-portal", inputs: ["container", "state"] }, { kind: "directive", type: NgtPortalAutoRender, selector: "ngt-portal[autoRender]", inputs: ["autoRender"] }, { kind: "directive", type: NgtPortalContent, selector: "ng-template[portalContent]" }, { kind: "component", type: NgtsOrthographicCamera, selector: "ngts-orthographic-camera", inputs: ["options"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
163
168
|
}
|
|
164
169
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgtsGizmoHelper, decorators: [{
|
|
165
170
|
type: Component,
|
|
@@ -170,16 +175,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
170
175
|
|
|
171
176
|
<ngt-portal
|
|
172
177
|
[container]="scene"
|
|
173
|
-
[autoRender]="
|
|
174
|
-
[autoRenderPriority]="_renderPriority"
|
|
178
|
+
[autoRender]="_renderPriority"
|
|
175
179
|
[state]="{ events: { priority: _renderPriority + 1 } }"
|
|
176
180
|
>
|
|
177
|
-
<ng-template portalContent let-injector="injector"
|
|
181
|
+
<ng-template portalContent let-injector="injector">
|
|
178
182
|
<ngts-orthographic-camera [options]="{ makeDefault: true, position: [0, 0, 200] }" />
|
|
179
183
|
<ngt-group #gizmo [position]="[x(), y(), 0]">
|
|
180
184
|
<ng-container
|
|
181
185
|
[ngTemplateOutlet]="content()"
|
|
182
|
-
[ngTemplateOutletContext]="{ container, injector }"
|
|
186
|
+
[ngTemplateOutletContext]="{ container: scene, injector }"
|
|
183
187
|
[ngTemplateOutletInjector]="injector"
|
|
184
188
|
/>
|
|
185
189
|
</ngt-group>
|
|
@@ -188,7 +192,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
188
192
|
`,
|
|
189
193
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
190
194
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
191
|
-
imports: [NgtPortal, NgtPortalContent, NgtsOrthographicCamera, NgTemplateOutlet],
|
|
195
|
+
imports: [NgtPortal, NgtPortalAutoRender, NgtPortalContent, NgtsOrthographicCamera, NgTemplateOutlet],
|
|
192
196
|
}]
|
|
193
197
|
}], ctorParameters: () => [] });
|
|
194
198
|
|
|
@@ -216,7 +220,6 @@ class FaceMaterial {
|
|
|
216
220
|
this.hoverColor = pick(this.options, 'hoverColor');
|
|
217
221
|
this.document = inject(DOCUMENT);
|
|
218
222
|
this.store = injectStore();
|
|
219
|
-
this.gl = this.store.select('gl');
|
|
220
223
|
this.opacity = pick(this.options, 'opacity');
|
|
221
224
|
this.materialColor = computed(() => (this.hover() ? this.hoverColor() : 'white'));
|
|
222
225
|
this.texture = computed(() => {
|
|
@@ -227,7 +230,7 @@ class FaceMaterial {
|
|
|
227
230
|
this.color(),
|
|
228
231
|
this.textColor(),
|
|
229
232
|
this.strokeColor(),
|
|
230
|
-
this.gl(),
|
|
233
|
+
this.store.gl(),
|
|
231
234
|
];
|
|
232
235
|
const canvas = this.document.createElement('canvas');
|
|
233
236
|
canvas.width = 128;
|
|
@@ -241,7 +244,7 @@ class FaceMaterial {
|
|
|
241
244
|
context.textAlign = 'center';
|
|
242
245
|
context.fillStyle = textColor;
|
|
243
246
|
context.fillText(faces[index].toUpperCase(), 64, 76);
|
|
244
|
-
const texture = new CanvasTexture(canvas);
|
|
247
|
+
const texture = new THREE.CanvasTexture(canvas);
|
|
245
248
|
texture.anisotropy = gl.capabilities.getMaxAnisotropy() || 1;
|
|
246
249
|
return texture;
|
|
247
250
|
});
|
|
@@ -253,7 +256,7 @@ class FaceMaterial {
|
|
|
253
256
|
[attach]="['material', index()]"
|
|
254
257
|
[map]="texture()"
|
|
255
258
|
[color]="materialColor()"
|
|
256
|
-
|
|
259
|
+
transparent
|
|
257
260
|
[opacity]="opacity()"
|
|
258
261
|
/>
|
|
259
262
|
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
@@ -267,7 +270,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
267
270
|
[attach]="['material', index()]"
|
|
268
271
|
[map]="texture()"
|
|
269
272
|
[color]="materialColor()"
|
|
270
|
-
|
|
273
|
+
transparent
|
|
271
274
|
[opacity]="opacity()"
|
|
272
275
|
/>
|
|
273
276
|
`,
|
|
@@ -429,7 +432,7 @@ class NgtsGizmoViewcube {
|
|
|
429
432
|
return undefined;
|
|
430
433
|
}
|
|
431
434
|
makePositionVector(xyz) {
|
|
432
|
-
return new Vector3(...xyz).multiplyScalar(0.38);
|
|
435
|
+
return new THREE.Vector3(...xyz).multiplyScalar(0.38);
|
|
433
436
|
}
|
|
434
437
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgtsGizmoViewcube, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
435
438
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.6", type: NgtsGizmoViewcube, isStandalone: true, selector: "ngts-gizmo-viewcube", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { click: "click" }, ngImport: i0, template: `
|
|
@@ -538,14 +541,13 @@ class AxisHead {
|
|
|
538
541
|
this.document = inject(DOCUMENT);
|
|
539
542
|
this.gizmoHelper = inject(NgtsGizmoHelper);
|
|
540
543
|
this.store = injectStore();
|
|
541
|
-
this.gl = this.store.select('gl');
|
|
542
544
|
this.texture = computed(() => {
|
|
543
545
|
const [arcStyle, label, labelColor, font, gl] = [
|
|
544
546
|
this.arcStyle(),
|
|
545
547
|
this.label(),
|
|
546
548
|
this.labelColor(),
|
|
547
549
|
this.font(),
|
|
548
|
-
this.gl(),
|
|
550
|
+
this.store.gl(),
|
|
549
551
|
];
|
|
550
552
|
const canvas = this.document.createElement('canvas');
|
|
551
553
|
canvas.width = 64;
|
|
@@ -562,7 +564,7 @@ class AxisHead {
|
|
|
562
564
|
context.fillStyle = labelColor;
|
|
563
565
|
context.fillText(label, 32, 41);
|
|
564
566
|
}
|
|
565
|
-
const texture = new CanvasTexture(canvas);
|
|
567
|
+
const texture = new THREE.CanvasTexture(canvas);
|
|
566
568
|
texture.anisotropy = gl.capabilities.getMaxAnisotropy() || 1;
|
|
567
569
|
return texture;
|
|
568
570
|
});
|
|
@@ -823,8 +825,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
823
825
|
}]
|
|
824
826
|
}], ctorParameters: () => [] });
|
|
825
827
|
|
|
826
|
-
const vec1$1 = new Vector3();
|
|
827
|
-
const vec2$1 = new Vector3();
|
|
828
|
+
const vec1$1 = new THREE.Vector3();
|
|
829
|
+
const vec2$1 = new THREE.Vector3();
|
|
828
830
|
function calculateOffset$1(clickPoint, normal, rayStart, rayDir) {
|
|
829
831
|
const e1 = normal.dot(normal);
|
|
830
832
|
const e2 = normal.dot(clickPoint) - normal.dot(rayStart);
|
|
@@ -843,18 +845,17 @@ function calculateOffset$1(clickPoint, normal, rayStart, rayDir) {
|
|
|
843
845
|
.sub(clickPoint);
|
|
844
846
|
return -vec1$1.dot(vec2$1) / vec1$1.dot(vec1$1);
|
|
845
847
|
}
|
|
846
|
-
const upV$1 = new Vector3(0, 1, 0);
|
|
847
|
-
const offsetMatrix$1 = new Matrix4();
|
|
848
|
+
const upV$1 = new THREE.Vector3(0, 1, 0);
|
|
849
|
+
const offsetMatrix$1 = new THREE.Matrix4();
|
|
848
850
|
class NgtsAxisArrow {
|
|
849
851
|
constructor() {
|
|
850
|
-
this.DoubleSide = DoubleSide;
|
|
852
|
+
this.DoubleSide = THREE.DoubleSide;
|
|
851
853
|
this.direction = input.required();
|
|
852
854
|
this.axis = input.required();
|
|
853
855
|
this.groupRef = viewChild.required('group');
|
|
854
856
|
this.annotationRef = viewChild('annotation', { read: ElementRef });
|
|
855
857
|
this.pivotControls = inject(NgtsPivotControls);
|
|
856
858
|
this.store = injectStore();
|
|
857
|
-
this.controls = this.store.select('controls');
|
|
858
859
|
this.hovered = signal(false);
|
|
859
860
|
this.clickInfo = null;
|
|
860
861
|
this.offset0 = 0;
|
|
@@ -865,8 +866,8 @@ class NgtsAxisArrow {
|
|
|
865
866
|
this.coneLength = computed(() => (this.pivotControls.fixed() ? 0.2 : this.pivotControls.scale() / 5));
|
|
866
867
|
this.cylinderLength = computed(() => this.pivotControls.fixed() ? 1 - this.coneLength() : this.pivotControls.scale() - this.coneLength());
|
|
867
868
|
this.matrixL = computed(() => {
|
|
868
|
-
const quaternion = new Quaternion().setFromUnitVectors(upV$1, this.direction().clone().normalize());
|
|
869
|
-
return new Matrix4().makeRotationFromQuaternion(quaternion);
|
|
869
|
+
const quaternion = new THREE.Quaternion().setFromUnitVectors(upV$1, this.direction().clone().normalize());
|
|
870
|
+
return new THREE.Matrix4().makeRotationFromQuaternion(quaternion);
|
|
870
871
|
});
|
|
871
872
|
extend({ Group, Mesh, ConeGeometry, CylinderGeometry, MeshBasicMaterial });
|
|
872
873
|
}
|
|
@@ -875,7 +876,7 @@ class NgtsAxisArrow {
|
|
|
875
876
|
this.groupRef().nativeElement,
|
|
876
877
|
this.direction(),
|
|
877
878
|
this.axis(),
|
|
878
|
-
this.controls(),
|
|
879
|
+
this.store.controls(),
|
|
879
880
|
this.annotationRef()?.nativeElement,
|
|
880
881
|
];
|
|
881
882
|
if (annotation) {
|
|
@@ -883,30 +884,31 @@ class NgtsAxisArrow {
|
|
|
883
884
|
annotation.style.display = 'block';
|
|
884
885
|
}
|
|
885
886
|
event.stopPropagation();
|
|
886
|
-
const rotation = new Matrix4().extractRotation(group.matrixWorld);
|
|
887
|
-
const origin = new Vector3().setFromMatrixPosition(group.matrixWorld);
|
|
887
|
+
const rotation = new THREE.Matrix4().extractRotation(group.matrixWorld);
|
|
888
|
+
const origin = new THREE.Vector3().setFromMatrixPosition(group.matrixWorld);
|
|
888
889
|
const clickPoint = event.point.clone();
|
|
889
890
|
const dir = direction.clone().applyMatrix4(rotation).normalize();
|
|
890
891
|
this.clickInfo = { clickPoint, dir };
|
|
891
892
|
this.offset0 = this.pivotControls.translation[axis];
|
|
892
893
|
this.pivotControls.onDragStart({ component: 'Arrow', axis, origin, directions: [dir] });
|
|
893
|
-
if (controls)
|
|
894
|
+
if (controls)
|
|
894
895
|
controls.enabled = false;
|
|
895
|
-
}
|
|
896
896
|
// @ts-expect-error - setPointerCapture is not in the type definition
|
|
897
897
|
event.target.setPointerCapture(event.pointerId);
|
|
898
898
|
}
|
|
899
899
|
onPointerUp(event) {
|
|
900
|
-
const [annotation, controls] = [
|
|
900
|
+
const [annotation, controls] = [
|
|
901
|
+
this.annotationRef()?.nativeElement,
|
|
902
|
+
this.store.controls(),
|
|
903
|
+
];
|
|
901
904
|
if (annotation) {
|
|
902
905
|
annotation.style.display = 'none';
|
|
903
906
|
}
|
|
904
907
|
event.stopPropagation();
|
|
905
908
|
this.clickInfo = null;
|
|
906
909
|
this.pivotControls.onDragEnd();
|
|
907
|
-
if (controls)
|
|
910
|
+
if (controls)
|
|
908
911
|
controls.enabled = true;
|
|
909
|
-
}
|
|
910
912
|
// @ts-expect-error - setPointerCapture is not in the type definition
|
|
911
913
|
event.target.releasePointerCapture(event.pointerId);
|
|
912
914
|
}
|
|
@@ -957,7 +959,7 @@ class NgtsAxisArrow {
|
|
|
957
959
|
<ngts-html [options]="{ position: [0, -coneLength(), 0] }">
|
|
958
960
|
<div
|
|
959
961
|
#annotation
|
|
960
|
-
|
|
962
|
+
htmlContent
|
|
961
963
|
style="display: none; background: #151520; color: white; padding: 6px 8px; border-radius: 7px; white-space: nowrap;"
|
|
962
964
|
[class]="pivotControls.annotationsClass()"
|
|
963
965
|
></div>
|
|
@@ -994,18 +996,18 @@ class NgtsAxisArrow {
|
|
|
994
996
|
<ngt-mesh [raycast]="null" [position]="[0, cylinderLength() + coneLength() / 2.0, 0]" [renderOrder]="500">
|
|
995
997
|
<ngt-cone-geometry *args="[coneWidth(), coneLength(), 24, 1]" />
|
|
996
998
|
<ngt-mesh-basic-material
|
|
997
|
-
|
|
999
|
+
transparent
|
|
1000
|
+
polygonOffset
|
|
998
1001
|
[depthTest]="pivotControls.depthTest()"
|
|
999
1002
|
[color]="color()"
|
|
1000
1003
|
[opacity]="pivotControls.opacity()"
|
|
1001
|
-
[polygonOffset]="true"
|
|
1002
1004
|
[polygonOffsetFactor]="-10"
|
|
1003
1005
|
[fog]="false"
|
|
1004
1006
|
/>
|
|
1005
1007
|
</ngt-mesh>
|
|
1006
1008
|
</ngt-group>
|
|
1007
1009
|
</ngt-group>
|
|
1008
|
-
`, 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: "[
|
|
1010
|
+
`, 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: i1.NgtsHTML, selector: "ngts-html", inputs: ["options"] }, { kind: "component", type: i1.NgtsHTMLContent, selector: "div[htmlContent]", inputs: ["htmlContent"], outputs: ["occluded"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1009
1011
|
}
|
|
1010
1012
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgtsAxisArrow, decorators: [{
|
|
1011
1013
|
type: Component,
|
|
@@ -1025,7 +1027,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
1025
1027
|
<ngts-html [options]="{ position: [0, -coneLength(), 0] }">
|
|
1026
1028
|
<div
|
|
1027
1029
|
#annotation
|
|
1028
|
-
|
|
1030
|
+
htmlContent
|
|
1029
1031
|
style="display: none; background: #151520; color: white; padding: 6px 8px; border-radius: 7px; white-space: nowrap;"
|
|
1030
1032
|
[class]="pivotControls.annotationsClass()"
|
|
1031
1033
|
></div>
|
|
@@ -1062,11 +1064,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
1062
1064
|
<ngt-mesh [raycast]="null" [position]="[0, cylinderLength() + coneLength() / 2.0, 0]" [renderOrder]="500">
|
|
1063
1065
|
<ngt-cone-geometry *args="[coneWidth(), coneLength(), 24, 1]" />
|
|
1064
1066
|
<ngt-mesh-basic-material
|
|
1065
|
-
|
|
1067
|
+
transparent
|
|
1068
|
+
polygonOffset
|
|
1066
1069
|
[depthTest]="pivotControls.depthTest()"
|
|
1067
1070
|
[color]="color()"
|
|
1068
1071
|
[opacity]="pivotControls.opacity()"
|
|
1069
|
-
[polygonOffset]="true"
|
|
1070
1072
|
[polygonOffsetFactor]="-10"
|
|
1071
1073
|
[fog]="false"
|
|
1072
1074
|
/>
|
|
@@ -1076,12 +1078,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
1076
1078
|
`,
|
|
1077
1079
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
1078
1080
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1079
|
-
imports: [NgtArgs, NgtsLine,
|
|
1081
|
+
imports: [NgtArgs, NgtsLine, NgtsHTMLDeclarations],
|
|
1080
1082
|
}]
|
|
1081
1083
|
}], ctorParameters: () => [] });
|
|
1082
1084
|
|
|
1083
|
-
const clickDir = new Vector3();
|
|
1084
|
-
const intersectionDir = new Vector3();
|
|
1085
|
+
const clickDir = new THREE.Vector3();
|
|
1086
|
+
const intersectionDir = new THREE.Vector3();
|
|
1085
1087
|
function toDegrees(radians) {
|
|
1086
1088
|
return (radians * 180) / Math.PI;
|
|
1087
1089
|
}
|
|
@@ -1116,13 +1118,13 @@ function minimizeAngle(angle) {
|
|
|
1116
1118
|
}
|
|
1117
1119
|
return result;
|
|
1118
1120
|
}
|
|
1119
|
-
const rotMatrix = new Matrix4();
|
|
1120
|
-
const posNew = new Vector3();
|
|
1121
|
-
const ray$1 = new Ray();
|
|
1122
|
-
const intersection$1 = new Vector3();
|
|
1121
|
+
const rotMatrix = new THREE.Matrix4();
|
|
1122
|
+
const posNew = new THREE.Vector3();
|
|
1123
|
+
const ray$1 = new THREE.Ray();
|
|
1124
|
+
const intersection$1 = new THREE.Vector3();
|
|
1123
1125
|
class NgtsAxisRotator {
|
|
1124
1126
|
constructor() {
|
|
1125
|
-
this.DoubleSide = DoubleSide;
|
|
1127
|
+
this.DoubleSide = THREE.DoubleSide;
|
|
1126
1128
|
this.dir1 = input.required();
|
|
1127
1129
|
this.dir2 = input.required();
|
|
1128
1130
|
this.axis = input.required();
|
|
@@ -1130,7 +1132,6 @@ class NgtsAxisRotator {
|
|
|
1130
1132
|
this.annotationRef = viewChild('annotation', { read: ElementRef });
|
|
1131
1133
|
this.pivotControls = inject(NgtsPivotControls);
|
|
1132
1134
|
this.store = injectStore();
|
|
1133
|
-
this.controls = this.store.select('controls');
|
|
1134
1135
|
this.hovered = signal(false);
|
|
1135
1136
|
this.angle = 0;
|
|
1136
1137
|
this.angle0 = 0;
|
|
@@ -1138,7 +1139,7 @@ class NgtsAxisRotator {
|
|
|
1138
1139
|
this.matrixL = computed(() => {
|
|
1139
1140
|
const dir1N = this.dir1().clone().normalize();
|
|
1140
1141
|
const dir2N = this.dir2().clone().normalize();
|
|
1141
|
-
return new Matrix4().makeBasis(dir1N, dir2N, dir1N.clone().cross(dir2N));
|
|
1142
|
+
return new THREE.Matrix4().makeBasis(dir1N, dir2N, dir1N.clone().cross(dir2N));
|
|
1142
1143
|
});
|
|
1143
1144
|
this.r = computed(() => (this.pivotControls.fixed() ? 0.65 : this.pivotControls.scale() * 0.65));
|
|
1144
1145
|
this.arc = computed(() => {
|
|
@@ -1146,7 +1147,7 @@ class NgtsAxisRotator {
|
|
|
1146
1147
|
const points = [];
|
|
1147
1148
|
for (let j = 0; j <= segments; j++) {
|
|
1148
1149
|
const angle = (j * (Math.PI / 2)) / segments;
|
|
1149
|
-
points.push(new Vector3(Math.cos(angle) * this.r(), Math.sin(angle) * this.r(), 0));
|
|
1150
|
+
points.push(new THREE.Vector3(Math.cos(angle) * this.r(), Math.sin(angle) * this.r(), 0));
|
|
1150
1151
|
}
|
|
1151
1152
|
return points;
|
|
1152
1153
|
});
|
|
@@ -1157,7 +1158,7 @@ class NgtsAxisRotator {
|
|
|
1157
1158
|
this.annotationRef()?.nativeElement,
|
|
1158
1159
|
this.groupRef().nativeElement,
|
|
1159
1160
|
this.axis(),
|
|
1160
|
-
this.controls(),
|
|
1161
|
+
this.store.controls(),
|
|
1161
1162
|
];
|
|
1162
1163
|
if (annotation) {
|
|
1163
1164
|
annotation.innerText = `${toDegrees(this.angle).toFixed(0)}º`;
|
|
@@ -1165,16 +1166,15 @@ class NgtsAxisRotator {
|
|
|
1165
1166
|
}
|
|
1166
1167
|
event.stopPropagation();
|
|
1167
1168
|
const clickPoint = event.point.clone();
|
|
1168
|
-
const origin = new Vector3().setFromMatrixPosition(group.matrixWorld);
|
|
1169
|
-
const e1 = new Vector3().setFromMatrixColumn(group.matrixWorld, 0).normalize();
|
|
1170
|
-
const e2 = new Vector3().setFromMatrixColumn(group.matrixWorld, 1).normalize();
|
|
1171
|
-
const normal = new Vector3().setFromMatrixColumn(group.matrixWorld, 2).normalize();
|
|
1172
|
-
const plane = new Plane().setFromNormalAndCoplanarPoint(normal, origin);
|
|
1169
|
+
const origin = new THREE.Vector3().setFromMatrixPosition(group.matrixWorld);
|
|
1170
|
+
const e1 = new THREE.Vector3().setFromMatrixColumn(group.matrixWorld, 0).normalize();
|
|
1171
|
+
const e2 = new THREE.Vector3().setFromMatrixColumn(group.matrixWorld, 1).normalize();
|
|
1172
|
+
const normal = new THREE.Vector3().setFromMatrixColumn(group.matrixWorld, 2).normalize();
|
|
1173
|
+
const plane = new THREE.Plane().setFromNormalAndCoplanarPoint(normal, origin);
|
|
1173
1174
|
this.clickInfo = { clickPoint, origin, e1, e2, normal, plane };
|
|
1174
1175
|
this.pivotControls.onDragStart({ component: 'Rotator', axis, origin, directions: [e1, e2, normal] });
|
|
1175
|
-
if (controls)
|
|
1176
|
+
if (controls)
|
|
1176
1177
|
controls.enabled = false;
|
|
1177
|
-
}
|
|
1178
1178
|
// @ts-expect-error - setPointerCapture is not a function on PointerEvent
|
|
1179
1179
|
event.target.setPointerCapture(event.pointerId);
|
|
1180
1180
|
}
|
|
@@ -1221,16 +1221,18 @@ class NgtsAxisRotator {
|
|
|
1221
1221
|
}
|
|
1222
1222
|
}
|
|
1223
1223
|
onPointerUp(event) {
|
|
1224
|
-
const [annotation, controls] = [
|
|
1224
|
+
const [annotation, controls] = [
|
|
1225
|
+
this.annotationRef()?.nativeElement,
|
|
1226
|
+
this.store.controls(),
|
|
1227
|
+
];
|
|
1225
1228
|
if (annotation) {
|
|
1226
1229
|
annotation.style.display = 'none';
|
|
1227
1230
|
}
|
|
1228
1231
|
event.stopPropagation();
|
|
1229
1232
|
this.clickInfo = null;
|
|
1230
1233
|
this.pivotControls.onDragEnd();
|
|
1231
|
-
if (controls)
|
|
1234
|
+
if (controls)
|
|
1232
1235
|
controls.enabled = true;
|
|
1233
|
-
}
|
|
1234
1236
|
// @ts-expect-error - releasePointerCapture is not a function on PointerEvent
|
|
1235
1237
|
event.target.releasePointerCapture(event.pointerId);
|
|
1236
1238
|
}
|
|
@@ -1253,7 +1255,7 @@ class NgtsAxisRotator {
|
|
|
1253
1255
|
<ngts-html [options]="{ position: [r(), r(), 0] }">
|
|
1254
1256
|
<div
|
|
1255
1257
|
#annotation
|
|
1256
|
-
|
|
1258
|
+
htmlContent
|
|
1257
1259
|
style="display: none; background: #151520; color: white; padding: 6px 8px; border-radius: 7px; white-space: nowrap"
|
|
1258
1260
|
[class]="pivotControls.annotationsClass()"
|
|
1259
1261
|
></div>
|
|
@@ -1281,7 +1283,7 @@ class NgtsAxisRotator {
|
|
|
1281
1283
|
}"
|
|
1282
1284
|
/>
|
|
1283
1285
|
</ngt-group>
|
|
1284
|
-
`, 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: "[
|
|
1286
|
+
`, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line", inputs: ["points", "options"] }, { kind: "component", type: i1.NgtsHTML, selector: "ngts-html", inputs: ["options"] }, { kind: "component", type: i1.NgtsHTMLContent, selector: "div[htmlContent]", inputs: ["htmlContent"], outputs: ["occluded"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1285
1287
|
}
|
|
1286
1288
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgtsAxisRotator, decorators: [{
|
|
1287
1289
|
type: Component,
|
|
@@ -1301,7 +1303,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
1301
1303
|
<ngts-html [options]="{ position: [r(), r(), 0] }">
|
|
1302
1304
|
<div
|
|
1303
1305
|
#annotation
|
|
1304
|
-
|
|
1306
|
+
htmlContent
|
|
1305
1307
|
style="display: none; background: #151520; color: white; padding: 6px 8px; border-radius: 7px; white-space: nowrap"
|
|
1306
1308
|
[class]="pivotControls.annotationsClass()"
|
|
1307
1309
|
></div>
|
|
@@ -1332,7 +1334,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
1332
1334
|
`,
|
|
1333
1335
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
1334
1336
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1335
|
-
imports: [NgtsLine,
|
|
1337
|
+
imports: [NgtsLine, NgtsHTMLDeclarations],
|
|
1336
1338
|
}]
|
|
1337
1339
|
}], ctorParameters: () => [] });
|
|
1338
1340
|
|
|
@@ -1354,12 +1356,12 @@ function decomposeIntoBasis(e1, e2, offset) {
|
|
|
1354
1356
|
const x = (c1 - y * b1) / a1;
|
|
1355
1357
|
return [x, y];
|
|
1356
1358
|
}
|
|
1357
|
-
const ray = new Ray();
|
|
1358
|
-
const intersection = new Vector3();
|
|
1359
|
-
const offsetMatrix = new Matrix4();
|
|
1359
|
+
const ray = new THREE.Ray();
|
|
1360
|
+
const intersection = new THREE.Vector3();
|
|
1361
|
+
const offsetMatrix = new THREE.Matrix4();
|
|
1360
1362
|
class NgtsPlaneSlider {
|
|
1361
1363
|
constructor() {
|
|
1362
|
-
this.DoubleSide = DoubleSide;
|
|
1364
|
+
this.DoubleSide = THREE.DoubleSide;
|
|
1363
1365
|
this.dir1 = input.required();
|
|
1364
1366
|
this.dir2 = input.required();
|
|
1365
1367
|
this.axis = input.required();
|
|
@@ -1367,7 +1369,6 @@ class NgtsPlaneSlider {
|
|
|
1367
1369
|
this.annotationRef = viewChild('annotation', { read: ElementRef });
|
|
1368
1370
|
this.pivotControls = inject(NgtsPivotControls);
|
|
1369
1371
|
this.store = injectStore();
|
|
1370
|
-
this.controls = this.store.select('controls');
|
|
1371
1372
|
this.hovered = signal(false);
|
|
1372
1373
|
this.clickInfo = null;
|
|
1373
1374
|
this.offsetX0 = 0;
|
|
@@ -1375,7 +1376,7 @@ class NgtsPlaneSlider {
|
|
|
1375
1376
|
this.matrixL = computed(() => {
|
|
1376
1377
|
const dir1N = this.dir1().clone().normalize();
|
|
1377
1378
|
const dir2N = this.dir2().clone().normalize();
|
|
1378
|
-
return new Matrix4().makeBasis(dir1N, dir2N, dir1N.clone().cross(dir2N));
|
|
1379
|
+
return new THREE.Matrix4().makeBasis(dir1N, dir2N, dir1N.clone().cross(dir2N));
|
|
1379
1380
|
});
|
|
1380
1381
|
this.pos1 = computed(() => (this.pivotControls.fixed() ? 1 / 7 : this.pivotControls.scale() / 7));
|
|
1381
1382
|
this.length = computed(() => (this.pivotControls.fixed() ? 0.225 : this.pivotControls.scale() * 0.225));
|
|
@@ -1383,11 +1384,11 @@ class NgtsPlaneSlider {
|
|
|
1383
1384
|
this.points = computed(() => {
|
|
1384
1385
|
const length = this.length();
|
|
1385
1386
|
return [
|
|
1386
|
-
new Vector3(0, 0, 0),
|
|
1387
|
-
new Vector3(0, length, 0),
|
|
1388
|
-
new Vector3(length, length, 0),
|
|
1389
|
-
new Vector3(length, 0, 0),
|
|
1390
|
-
new Vector3(0, 0, 0),
|
|
1387
|
+
new THREE.Vector3(0, 0, 0),
|
|
1388
|
+
new THREE.Vector3(0, length, 0),
|
|
1389
|
+
new THREE.Vector3(length, length, 0),
|
|
1390
|
+
new THREE.Vector3(length, 0, 0),
|
|
1391
|
+
new THREE.Vector3(0, 0, 0),
|
|
1391
1392
|
];
|
|
1392
1393
|
});
|
|
1393
1394
|
extend({ Group, Mesh, PlaneGeometry, MeshBasicMaterial });
|
|
@@ -1397,7 +1398,7 @@ class NgtsPlaneSlider {
|
|
|
1397
1398
|
this.annotationRef()?.nativeElement,
|
|
1398
1399
|
this.axis(),
|
|
1399
1400
|
this.groupRef().nativeElement,
|
|
1400
|
-
this.controls(),
|
|
1401
|
+
this.store.controls(),
|
|
1401
1402
|
];
|
|
1402
1403
|
if (annotation) {
|
|
1403
1404
|
annotation.innerText = `${this.pivotControls.translation[(axis + 1) % 3].toFixed(2)}, ${this.pivotControls.translation[(axis + 2) % 3].toFixed(2)}`;
|
|
@@ -1405,18 +1406,17 @@ class NgtsPlaneSlider {
|
|
|
1405
1406
|
}
|
|
1406
1407
|
event.stopPropagation();
|
|
1407
1408
|
const clickPoint = event.point.clone();
|
|
1408
|
-
const origin = new Vector3().setFromMatrixPosition(group.matrixWorld);
|
|
1409
|
-
const e1 = new Vector3().setFromMatrixColumn(group.matrixWorld, 0).normalize();
|
|
1410
|
-
const e2 = new Vector3().setFromMatrixColumn(group.matrixWorld, 1).normalize();
|
|
1411
|
-
const normal = new Vector3().setFromMatrixColumn(group.matrixWorld, 2).normalize();
|
|
1412
|
-
const plane = new Plane().setFromNormalAndCoplanarPoint(normal, origin);
|
|
1409
|
+
const origin = new THREE.Vector3().setFromMatrixPosition(group.matrixWorld);
|
|
1410
|
+
const e1 = new THREE.Vector3().setFromMatrixColumn(group.matrixWorld, 0).normalize();
|
|
1411
|
+
const e2 = new THREE.Vector3().setFromMatrixColumn(group.matrixWorld, 1).normalize();
|
|
1412
|
+
const normal = new THREE.Vector3().setFromMatrixColumn(group.matrixWorld, 2).normalize();
|
|
1413
|
+
const plane = new THREE.Plane().setFromNormalAndCoplanarPoint(normal, origin);
|
|
1413
1414
|
this.clickInfo = { clickPoint, e1, e2, plane };
|
|
1414
1415
|
this.offsetX0 = this.pivotControls.translation[(axis + 1) % 3];
|
|
1415
1416
|
this.offsetY0 = this.pivotControls.translation[(axis + 2) % 3];
|
|
1416
1417
|
this.pivotControls.onDragStart({ component: 'Slider', axis, origin, directions: [e1, e2, normal] });
|
|
1417
|
-
if (controls)
|
|
1418
|
+
if (controls)
|
|
1418
1419
|
controls.enabled = false;
|
|
1419
|
-
}
|
|
1420
1420
|
// @ts-expect-error - setPointerCapture is not defined on ThreeEvent
|
|
1421
1421
|
event.target.setPointerCapture(event.pointerId);
|
|
1422
1422
|
}
|
|
@@ -1463,16 +1463,18 @@ class NgtsPlaneSlider {
|
|
|
1463
1463
|
}
|
|
1464
1464
|
}
|
|
1465
1465
|
onPointerUp(event) {
|
|
1466
|
-
const [annotation, controls] = [
|
|
1466
|
+
const [annotation, controls] = [
|
|
1467
|
+
this.annotationRef()?.nativeElement,
|
|
1468
|
+
this.store.controls(),
|
|
1469
|
+
];
|
|
1467
1470
|
if (annotation) {
|
|
1468
1471
|
annotation.style.display = 'none';
|
|
1469
1472
|
}
|
|
1470
1473
|
event.stopPropagation();
|
|
1471
1474
|
this.clickInfo = null;
|
|
1472
1475
|
this.pivotControls.onDragEnd();
|
|
1473
|
-
if (controls)
|
|
1476
|
+
if (controls)
|
|
1474
1477
|
controls.enabled = true;
|
|
1475
|
-
}
|
|
1476
1478
|
// @ts-expect-error - releasePointerCapture is not defined on ThreeEvent
|
|
1477
1479
|
event.target.releasePointerCapture(event.pointerId);
|
|
1478
1480
|
}
|
|
@@ -1487,7 +1489,7 @@ class NgtsPlaneSlider {
|
|
|
1487
1489
|
<ngts-html [options]="{ position: [0, 0, 0] }">
|
|
1488
1490
|
<div
|
|
1489
1491
|
#annotation
|
|
1490
|
-
|
|
1492
|
+
htmlContent
|
|
1491
1493
|
style="display: none; background: #151520; color: white; padding: 6px 8px; border-radius: 7px; white-space: nowrap"
|
|
1492
1494
|
[class]="pivotControls.annotationsClass()"
|
|
1493
1495
|
></div>
|
|
@@ -1495,7 +1497,7 @@ class NgtsPlaneSlider {
|
|
|
1495
1497
|
}
|
|
1496
1498
|
<ngt-group [position]="[pos1() * 1.7, pos1() * 1.7, 0]">
|
|
1497
1499
|
<ngt-mesh
|
|
1498
|
-
|
|
1500
|
+
visible
|
|
1499
1501
|
[scale]="length()"
|
|
1500
1502
|
[userData]="pivotControls.userData()"
|
|
1501
1503
|
(pointerdown)="onPointerDown($any($event))"
|
|
@@ -1505,10 +1507,10 @@ class NgtsPlaneSlider {
|
|
|
1505
1507
|
>
|
|
1506
1508
|
<ngt-plane-geometry />
|
|
1507
1509
|
<ngt-mesh-basic-material
|
|
1508
|
-
|
|
1510
|
+
transparent
|
|
1511
|
+
polygonOffset
|
|
1509
1512
|
[depthTest]="pivotControls.depthTest()"
|
|
1510
1513
|
[color]="color()"
|
|
1511
|
-
[polygonOffset]="true"
|
|
1512
1514
|
[polygonOffsetFactor]="-10"
|
|
1513
1515
|
[side]="DoubleSide"
|
|
1514
1516
|
[fog]="false"
|
|
@@ -1531,7 +1533,7 @@ class NgtsPlaneSlider {
|
|
|
1531
1533
|
/>
|
|
1532
1534
|
</ngt-group>
|
|
1533
1535
|
</ngt-group>
|
|
1534
|
-
`, isInline: true, dependencies: [{ kind: "component", type: NgtsHTML, selector: "ngts-html", inputs: ["options"] }, { kind: "component", type: NgtsHTMLContent, selector: "[
|
|
1536
|
+
`, isInline: true, dependencies: [{ kind: "component", type: i1.NgtsHTML, selector: "ngts-html", inputs: ["options"] }, { kind: "component", type: i1.NgtsHTMLContent, selector: "div[htmlContent]", inputs: ["htmlContent"], outputs: ["occluded"] }, { kind: "component", type: NgtsLine, selector: "ngts-line", inputs: ["points", "options"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1535
1537
|
}
|
|
1536
1538
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgtsPlaneSlider, decorators: [{
|
|
1537
1539
|
type: Component,
|
|
@@ -1543,7 +1545,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
1543
1545
|
<ngts-html [options]="{ position: [0, 0, 0] }">
|
|
1544
1546
|
<div
|
|
1545
1547
|
#annotation
|
|
1546
|
-
|
|
1548
|
+
htmlContent
|
|
1547
1549
|
style="display: none; background: #151520; color: white; padding: 6px 8px; border-radius: 7px; white-space: nowrap"
|
|
1548
1550
|
[class]="pivotControls.annotationsClass()"
|
|
1549
1551
|
></div>
|
|
@@ -1551,7 +1553,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
1551
1553
|
}
|
|
1552
1554
|
<ngt-group [position]="[pos1() * 1.7, pos1() * 1.7, 0]">
|
|
1553
1555
|
<ngt-mesh
|
|
1554
|
-
|
|
1556
|
+
visible
|
|
1555
1557
|
[scale]="length()"
|
|
1556
1558
|
[userData]="pivotControls.userData()"
|
|
1557
1559
|
(pointerdown)="onPointerDown($any($event))"
|
|
@@ -1561,10 +1563,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
1561
1563
|
>
|
|
1562
1564
|
<ngt-plane-geometry />
|
|
1563
1565
|
<ngt-mesh-basic-material
|
|
1564
|
-
|
|
1566
|
+
transparent
|
|
1567
|
+
polygonOffset
|
|
1565
1568
|
[depthTest]="pivotControls.depthTest()"
|
|
1566
1569
|
[color]="color()"
|
|
1567
|
-
[polygonOffset]="true"
|
|
1568
1570
|
[polygonOffsetFactor]="-10"
|
|
1569
1571
|
[side]="DoubleSide"
|
|
1570
1572
|
[fog]="false"
|
|
@@ -1590,12 +1592,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
1590
1592
|
`,
|
|
1591
1593
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
1592
1594
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1593
|
-
imports: [
|
|
1595
|
+
imports: [NgtsHTMLDeclarations, NgtsLine],
|
|
1594
1596
|
}]
|
|
1595
1597
|
}], ctorParameters: () => [] });
|
|
1596
1598
|
|
|
1597
|
-
const vec1 = new Vector3();
|
|
1598
|
-
const vec2 = new Vector3();
|
|
1599
|
+
const vec1 = new THREE.Vector3();
|
|
1600
|
+
const vec2 = new THREE.Vector3();
|
|
1599
1601
|
function calculateOffset(clickPoint, normal, rayStart, rayDir) {
|
|
1600
1602
|
const e1 = normal.dot(normal);
|
|
1601
1603
|
const e2 = normal.dot(clickPoint) - normal.dot(rayStart);
|
|
@@ -1614,9 +1616,9 @@ function calculateOffset(clickPoint, normal, rayStart, rayDir) {
|
|
|
1614
1616
|
.sub(clickPoint);
|
|
1615
1617
|
return -vec1.dot(vec2) / vec1.dot(vec1);
|
|
1616
1618
|
}
|
|
1617
|
-
const upV = new Vector3(0, 1, 0);
|
|
1618
|
-
const scaleV = new Vector3();
|
|
1619
|
-
const scaleMatrix = new Matrix4();
|
|
1619
|
+
const upV = new THREE.Vector3(0, 1, 0);
|
|
1620
|
+
const scaleV = new THREE.Vector3();
|
|
1621
|
+
const scaleMatrix = new THREE.Matrix4();
|
|
1620
1622
|
class NgtsScalingSphere {
|
|
1621
1623
|
constructor() {
|
|
1622
1624
|
this.direction = input.required();
|
|
@@ -1626,8 +1628,6 @@ class NgtsScalingSphere {
|
|
|
1626
1628
|
this.meshRef = viewChild.required('mesh');
|
|
1627
1629
|
this.pivotControls = inject(NgtsPivotControls);
|
|
1628
1630
|
this.store = injectStore();
|
|
1629
|
-
this.controls = this.store.select('controls');
|
|
1630
|
-
this.size = this.store.select('size');
|
|
1631
1631
|
this.hovered = signal(false);
|
|
1632
1632
|
this.scale0 = 1;
|
|
1633
1633
|
this.scaleCurrent = 1;
|
|
@@ -1637,8 +1637,8 @@ class NgtsScalingSphere {
|
|
|
1637
1637
|
? (this.pivotControls.lineWidth() / this.pivotControls.scale()) * 1.8
|
|
1638
1638
|
: this.pivotControls.scale() / 22.5);
|
|
1639
1639
|
this.matrixL = computed(() => {
|
|
1640
|
-
const quaternion = new Quaternion().setFromUnitVectors(upV, this.direction().clone().normalize());
|
|
1641
|
-
return new Matrix4().makeRotationFromQuaternion(quaternion);
|
|
1640
|
+
const quaternion = new THREE.Quaternion().setFromUnitVectors(upV, this.direction().clone().normalize());
|
|
1641
|
+
return new THREE.Matrix4().makeRotationFromQuaternion(quaternion);
|
|
1642
1642
|
});
|
|
1643
1643
|
this.color = computed(() => this.hovered() ? this.pivotControls.hoveredColor() : this.pivotControls.axisColors()[this.axis()]);
|
|
1644
1644
|
extend({ Group, Mesh, SphereGeometry, MeshBasicMaterial });
|
|
@@ -1646,12 +1646,12 @@ class NgtsScalingSphere {
|
|
|
1646
1646
|
onPointerDown(event) {
|
|
1647
1647
|
const [annotation, controls, fixed, scale, direction, axis, size, group] = [
|
|
1648
1648
|
this.annotationRef()?.nativeElement,
|
|
1649
|
-
this.controls(),
|
|
1649
|
+
this.store.controls(),
|
|
1650
1650
|
this.pivotControls.fixed(),
|
|
1651
1651
|
this.pivotControls.scale(),
|
|
1652
1652
|
this.direction(),
|
|
1653
1653
|
this.axis(),
|
|
1654
|
-
this.size(),
|
|
1654
|
+
this.store.size(),
|
|
1655
1655
|
this.groupRef().nativeElement,
|
|
1656
1656
|
];
|
|
1657
1657
|
if (annotation) {
|
|
@@ -1659,9 +1659,9 @@ class NgtsScalingSphere {
|
|
|
1659
1659
|
annotation.style.display = 'block';
|
|
1660
1660
|
}
|
|
1661
1661
|
event.stopPropagation();
|
|
1662
|
-
const rotation = new Matrix4().extractRotation(group.matrixWorld);
|
|
1662
|
+
const rotation = new THREE.Matrix4().extractRotation(group.matrixWorld);
|
|
1663
1663
|
const clickPoint = event.point.clone();
|
|
1664
|
-
const origin = new Vector3().setFromMatrixPosition(group.matrixWorld);
|
|
1664
|
+
const origin = new THREE.Vector3().setFromMatrixPosition(group.matrixWorld);
|
|
1665
1665
|
const dir = direction.clone().applyMatrix4(rotation).normalize();
|
|
1666
1666
|
const mPLG = group.matrixWorld.clone();
|
|
1667
1667
|
const mPLGInv = mPLG.clone().invert();
|
|
@@ -1670,9 +1670,8 @@ class NgtsScalingSphere {
|
|
|
1670
1670
|
: 1;
|
|
1671
1671
|
this.clickInfo = { clickPoint, dir, mPLG, mPLGInv, offsetMultiplier };
|
|
1672
1672
|
this.pivotControls.onDragStart({ component: 'Sphere', axis, origin, directions: [dir] });
|
|
1673
|
-
if (controls)
|
|
1673
|
+
if (controls)
|
|
1674
1674
|
controls.enabled = false;
|
|
1675
|
-
}
|
|
1676
1675
|
// @ts-expect-error - setPointerCapture is not in the type definition
|
|
1677
1676
|
event.target.setPointerCapture(event.pointerId);
|
|
1678
1677
|
}
|
|
@@ -1717,7 +1716,7 @@ class NgtsScalingSphere {
|
|
|
1717
1716
|
onPointerUp(event) {
|
|
1718
1717
|
const [annotation, controls, position, mesh] = [
|
|
1719
1718
|
this.annotationRef()?.nativeElement,
|
|
1720
|
-
this.controls(),
|
|
1719
|
+
this.store.controls(),
|
|
1721
1720
|
this.position(),
|
|
1722
1721
|
this.meshRef().nativeElement,
|
|
1723
1722
|
];
|
|
@@ -1729,9 +1728,8 @@ class NgtsScalingSphere {
|
|
|
1729
1728
|
this.clickInfo = null;
|
|
1730
1729
|
mesh.position.set(0, position, 0);
|
|
1731
1730
|
this.pivotControls.onDragEnd();
|
|
1732
|
-
if (controls)
|
|
1731
|
+
if (controls)
|
|
1733
1732
|
controls.enabled = true;
|
|
1734
|
-
}
|
|
1735
1733
|
// @ts-expect-error - releasePointerCapture is not in the type definition
|
|
1736
1734
|
event.target.releasePointerCapture(event.pointerId);
|
|
1737
1735
|
}
|
|
@@ -1754,7 +1752,7 @@ class NgtsScalingSphere {
|
|
|
1754
1752
|
<ngts-html [options]="{ position: [0, position() / 2, 0] }">
|
|
1755
1753
|
<div
|
|
1756
1754
|
#annotation
|
|
1757
|
-
|
|
1755
|
+
htmlContent
|
|
1758
1756
|
style="display: none; background: #151520; color: white; padding: 6px 8px; border-radius: 7px; white-space: nowrap;"
|
|
1759
1757
|
[class]="pivotControls.annotationsClass()"
|
|
1760
1758
|
></div>
|
|
@@ -1773,7 +1771,7 @@ class NgtsScalingSphere {
|
|
|
1773
1771
|
</ngt-mesh>
|
|
1774
1772
|
</ngt-group>
|
|
1775
1773
|
</ngt-group>
|
|
1776
|
-
`, isInline: true, dependencies: [{ kind: "component", type: NgtsHTML, selector: "ngts-html", inputs: ["options"] }, { kind: "component", type: NgtsHTMLContent, selector: "[
|
|
1774
|
+
`, isInline: true, dependencies: [{ kind: "component", type: i1.NgtsHTML, selector: "ngts-html", inputs: ["options"] }, { kind: "component", type: i1.NgtsHTMLContent, selector: "div[htmlContent]", inputs: ["htmlContent"], outputs: ["occluded"] }, { kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1777
1775
|
}
|
|
1778
1776
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgtsScalingSphere, decorators: [{
|
|
1779
1777
|
type: Component,
|
|
@@ -1793,7 +1791,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
1793
1791
|
<ngts-html [options]="{ position: [0, position() / 2, 0] }">
|
|
1794
1792
|
<div
|
|
1795
1793
|
#annotation
|
|
1796
|
-
|
|
1794
|
+
htmlContent
|
|
1797
1795
|
style="display: none; background: #151520; color: white; padding: 6px 8px; border-radius: 7px; white-space: nowrap;"
|
|
1798
1796
|
[class]="pivotControls.annotationsClass()"
|
|
1799
1797
|
></div>
|
|
@@ -1815,29 +1813,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
1815
1813
|
`,
|
|
1816
1814
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
1817
1815
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1818
|
-
imports: [
|
|
1816
|
+
imports: [NgtsHTMLDeclarations, NgtArgs],
|
|
1819
1817
|
}]
|
|
1820
1818
|
}], ctorParameters: () => [] });
|
|
1821
1819
|
|
|
1822
|
-
const mL0 = new Matrix4();
|
|
1823
|
-
const mW0 = new Matrix4();
|
|
1824
|
-
const mP = new Matrix4();
|
|
1825
|
-
const mPInv = new Matrix4();
|
|
1826
|
-
const mW = new Matrix4();
|
|
1827
|
-
const mL = new Matrix4();
|
|
1828
|
-
const mL0Inv = new Matrix4();
|
|
1829
|
-
const mdL = new Matrix4();
|
|
1830
|
-
const mG = new Matrix4();
|
|
1831
|
-
const bb = new Box3();
|
|
1832
|
-
const bbObj = new Box3();
|
|
1833
|
-
const vCenter = new Vector3();
|
|
1834
|
-
const vSize = new Vector3();
|
|
1835
|
-
const vAnchorOffset = new Vector3();
|
|
1836
|
-
const vPosition = new Vector3();
|
|
1837
|
-
const vScale = new Vector3();
|
|
1838
|
-
const xDir = new Vector3(1, 0, 0);
|
|
1839
|
-
const yDir = new Vector3(0, 1, 0);
|
|
1840
|
-
const zDir = new Vector3(0, 0, 1);
|
|
1820
|
+
const mL0 = new THREE.Matrix4();
|
|
1821
|
+
const mW0 = new THREE.Matrix4();
|
|
1822
|
+
const mP = new THREE.Matrix4();
|
|
1823
|
+
const mPInv = new THREE.Matrix4();
|
|
1824
|
+
const mW = new THREE.Matrix4();
|
|
1825
|
+
const mL = new THREE.Matrix4();
|
|
1826
|
+
const mL0Inv = new THREE.Matrix4();
|
|
1827
|
+
const mdL = new THREE.Matrix4();
|
|
1828
|
+
const mG = new THREE.Matrix4();
|
|
1829
|
+
const bb = new THREE.Box3();
|
|
1830
|
+
const bbObj = new THREE.Box3();
|
|
1831
|
+
const vCenter = new THREE.Vector3();
|
|
1832
|
+
const vSize = new THREE.Vector3();
|
|
1833
|
+
const vAnchorOffset = new THREE.Vector3();
|
|
1834
|
+
const vPosition = new THREE.Vector3();
|
|
1835
|
+
const vScale = new THREE.Vector3();
|
|
1836
|
+
const xDir = new THREE.Vector3(1, 0, 0);
|
|
1837
|
+
const yDir = new THREE.Vector3(0, 1, 0);
|
|
1838
|
+
const zDir = new THREE.Vector3(0, 0, 1);
|
|
1841
1839
|
const defaultOptions = {
|
|
1842
1840
|
enabled: true,
|
|
1843
1841
|
autoTransform: true,
|
|
@@ -1858,7 +1856,6 @@ const defaultOptions = {
|
|
|
1858
1856
|
opacity: 1,
|
|
1859
1857
|
visible: true,
|
|
1860
1858
|
};
|
|
1861
|
-
// TODO: PivotControls is not working properly with control flow
|
|
1862
1859
|
class NgtsPivotControls {
|
|
1863
1860
|
constructor() {
|
|
1864
1861
|
this.options = input(defaultOptions, { transform: mergeInputs(defaultOptions) });
|
|
@@ -1892,13 +1889,22 @@ class NgtsPivotControls {
|
|
|
1892
1889
|
this.dragStarted = output();
|
|
1893
1890
|
this.dragEnded = output();
|
|
1894
1891
|
this.dragged = output();
|
|
1892
|
+
this.autoTransform = pick(this.options, 'autoTransform');
|
|
1895
1893
|
this.matrix = pick(this.options, 'matrix');
|
|
1894
|
+
this.offset = pick(this.options, 'offset');
|
|
1895
|
+
this.rotation = pick(this.options, 'rotation');
|
|
1896
|
+
this.visible = pick(this.options, 'visible');
|
|
1897
|
+
this.enabled = pick(this.options, 'enabled');
|
|
1898
|
+
this.disableAxes = pick(this.options, 'disableAxes');
|
|
1899
|
+
this.disableSliders = pick(this.options, 'disableSliders');
|
|
1900
|
+
this.disableRotations = pick(this.options, 'disableRotations');
|
|
1901
|
+
this.disableScaling = pick(this.options, 'disableScaling');
|
|
1902
|
+
this.activeAxes = pick(this.options, 'activeAxes');
|
|
1896
1903
|
this.annotations = pick(this.options, 'annotations');
|
|
1897
1904
|
this.annotationsClass = pick(this.options, 'annotationsClass');
|
|
1898
1905
|
this.translationLimits = pick(this.options, 'translationLimits');
|
|
1899
1906
|
this.rotationLimits = pick(this.options, 'rotationLimits');
|
|
1900
1907
|
this.scaleLimits = pick(this.options, 'scaleLimits');
|
|
1901
|
-
this.autoTransform = pick(this.options, 'autoTransform');
|
|
1902
1908
|
this.fixed = pick(this.options, 'fixed');
|
|
1903
1909
|
this.hoveredColor = pick(this.options, 'hoveredColor');
|
|
1904
1910
|
this.axisColors = pick(this.options, 'axisColors');
|
|
@@ -1907,15 +1913,6 @@ class NgtsPivotControls {
|
|
|
1907
1913
|
this.userData = pick(this.options, 'userData');
|
|
1908
1914
|
this.opacity = pick(this.options, 'opacity');
|
|
1909
1915
|
this.depthTest = pick(this.options, 'depthTest');
|
|
1910
|
-
this.offset = pick(this.options, 'offset');
|
|
1911
|
-
this.rotation = pick(this.options, 'rotation');
|
|
1912
|
-
this.visible = pick(this.options, 'visible');
|
|
1913
|
-
this.enabled = pick(this.options, 'enabled');
|
|
1914
|
-
this.disableAxes = pick(this.options, 'disableAxes');
|
|
1915
|
-
this.disableSliders = pick(this.options, 'disableSliders');
|
|
1916
|
-
this.disableRotations = pick(this.options, 'disableRotations');
|
|
1917
|
-
this.disableScaling = pick(this.options, 'disableScaling');
|
|
1918
|
-
this.activeAxes = pick(this.options, 'activeAxes');
|
|
1919
1916
|
this.xDir = xDir;
|
|
1920
1917
|
this.yDir = yDir;
|
|
1921
1918
|
this.zDir = zDir;
|
|
@@ -1924,26 +1921,25 @@ class NgtsPivotControls {
|
|
|
1924
1921
|
this.gizmoRef = viewChild.required('gizmo');
|
|
1925
1922
|
this.childrenRef = viewChild.required('children');
|
|
1926
1923
|
this.store = injectStore();
|
|
1927
|
-
this.invalidate = this.store.select('invalidate');
|
|
1928
1924
|
this.translation = [0, 0, 0];
|
|
1929
1925
|
this.anchor = pick(this.options, 'anchor');
|
|
1930
|
-
this.cameraScale = new Vector3(1, 1, 1);
|
|
1931
|
-
this.gizmoScale = new Vector3(1, 1, 1);
|
|
1926
|
+
this.cameraScale = new THREE.Vector3(1, 1, 1);
|
|
1927
|
+
this.gizmoScale = new THREE.Vector3(1, 1, 1);
|
|
1932
1928
|
extend({ Group });
|
|
1933
1929
|
effect(() => {
|
|
1934
1930
|
const anchor = this.anchor();
|
|
1935
1931
|
if (!anchor)
|
|
1936
1932
|
return;
|
|
1937
1933
|
const childrenContainer = this.childrenRef().nativeElement;
|
|
1938
|
-
const
|
|
1939
|
-
if (!
|
|
1934
|
+
const instanceState = getInstanceState(childrenContainer);
|
|
1935
|
+
if (!instanceState)
|
|
1940
1936
|
return;
|
|
1941
1937
|
const [gizmo, offset, invalidate] = [
|
|
1942
1938
|
this.gizmoRef().nativeElement,
|
|
1943
1939
|
this.offset(),
|
|
1944
|
-
this.invalidate(),
|
|
1940
|
+
this.store.invalidate(),
|
|
1945
1941
|
this.options(),
|
|
1946
|
-
[
|
|
1942
|
+
[instanceState.objects(), instanceState.nonObjects()],
|
|
1947
1943
|
];
|
|
1948
1944
|
childrenContainer.updateWorldMatrix(true, true);
|
|
1949
1945
|
mPInv.copy(childrenContainer.matrixWorld).invert();
|
|
@@ -1965,13 +1961,13 @@ class NgtsPivotControls {
|
|
|
1965
1961
|
vSize.copy(bb.max).sub(bb.min).multiplyScalar(0.5);
|
|
1966
1962
|
vAnchorOffset
|
|
1967
1963
|
.copy(vSize)
|
|
1968
|
-
.multiply(new Vector3(...anchor))
|
|
1964
|
+
.multiply(new THREE.Vector3(...anchor))
|
|
1969
1965
|
.add(vCenter);
|
|
1970
1966
|
vPosition.set(...offset).add(vAnchorOffset);
|
|
1971
1967
|
gizmo.position.copy(vPosition);
|
|
1972
1968
|
invalidate();
|
|
1973
1969
|
});
|
|
1974
|
-
const vec = new Vector3();
|
|
1970
|
+
const vec = new THREE.Vector3();
|
|
1975
1971
|
injectBeforeRender(({ camera, size, invalidate }) => {
|
|
1976
1972
|
const [{ fixed, scale, matrix }, gizmo, group] = [
|
|
1977
1973
|
this.options(),
|
|
@@ -1982,7 +1978,7 @@ class NgtsPivotControls {
|
|
|
1982
1978
|
const sf = calculateScaleFactor(gizmo.getWorldPosition(vec), scale, camera, size);
|
|
1983
1979
|
this.cameraScale.setScalar(sf);
|
|
1984
1980
|
}
|
|
1985
|
-
if (matrix
|
|
1981
|
+
if (is.three(matrix, 'isMatrix4')) {
|
|
1986
1982
|
group.matrix = matrix;
|
|
1987
1983
|
}
|
|
1988
1984
|
// Update gizmo scale in accordance with matrix changes
|
|
@@ -2199,19 +2195,14 @@ class NgtsTransformControls {
|
|
|
2199
2195
|
this.objectChange = output();
|
|
2200
2196
|
this.groupRef = viewChild.required('group');
|
|
2201
2197
|
this.store = injectStore();
|
|
2202
|
-
this.glDomElement = this.store.select('gl', 'domElement');
|
|
2203
|
-
this.defaultCamera = this.store.select('camera');
|
|
2204
|
-
this.events = this.store.select('events');
|
|
2205
|
-
this.defaultControls = this.store.select('controls');
|
|
2206
|
-
this.invalidate = this.store.select('invalidate');
|
|
2207
2198
|
this.controls = computed(() => {
|
|
2208
2199
|
let camera = this.camera();
|
|
2209
2200
|
if (!camera) {
|
|
2210
|
-
camera = this.
|
|
2201
|
+
camera = this.store.camera();
|
|
2211
2202
|
}
|
|
2212
2203
|
let domElement = this.domElement();
|
|
2213
2204
|
if (!domElement) {
|
|
2214
|
-
domElement = this.events().connected || this.
|
|
2205
|
+
domElement = this.store.events().connected || this.store.gl.domElement();
|
|
2215
2206
|
}
|
|
2216
2207
|
return new TransformControls(camera, domElement);
|
|
2217
2208
|
});
|
|
@@ -2237,10 +2228,10 @@ class NgtsTransformControls {
|
|
|
2237
2228
|
const group = this.groupRef().nativeElement;
|
|
2238
2229
|
if (!group)
|
|
2239
2230
|
return;
|
|
2240
|
-
const
|
|
2241
|
-
if (!
|
|
2231
|
+
const instanceState = getInstanceState(group);
|
|
2232
|
+
if (!instanceState)
|
|
2242
2233
|
return;
|
|
2243
|
-
const [object, controls] = [resolveRef(this.object()), this.controls(),
|
|
2234
|
+
const [object, controls] = [resolveRef(this.object()), this.controls(), instanceState.objects()];
|
|
2244
2235
|
if (object) {
|
|
2245
2236
|
controls.attach(object);
|
|
2246
2237
|
}
|
|
@@ -2250,7 +2241,7 @@ class NgtsTransformControls {
|
|
|
2250
2241
|
return () => controls.detach();
|
|
2251
2242
|
}
|
|
2252
2243
|
disableDefaultControlsEffect() {
|
|
2253
|
-
const defaultControls = this.
|
|
2244
|
+
const defaultControls = this.store.controls();
|
|
2254
2245
|
if (!defaultControls)
|
|
2255
2246
|
return;
|
|
2256
2247
|
const controls = this.controls();
|
|
@@ -2265,7 +2256,7 @@ class NgtsTransformControls {
|
|
|
2265
2256
|
};
|
|
2266
2257
|
}
|
|
2267
2258
|
setupControlsEventsEffect() {
|
|
2268
|
-
const [controls, invalidate] = [this.controls(), this.invalidate()];
|
|
2259
|
+
const [controls, invalidate] = [this.controls(), this.store.invalidate()];
|
|
2269
2260
|
const onChange = (event) => {
|
|
2270
2261
|
invalidate();
|
|
2271
2262
|
if (!this.change['destroyed']) {
|