three-cad-viewer 1.7.5 → 1.7.6
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/dist/three-cad-viewer.esm.js +35 -31
- package/dist/three-cad-viewer.esm.min.js +1 -1
- package/dist/three-cad-viewer.js +35 -31
- package/dist/three-cad-viewer.min.js +1 -1
- package/package.json +1 -1
- package/src/_version.js +1 -1
- package/src/nestedgroup.js +6 -1
- package/src/viewer.js +28 -29
|
@@ -54420,7 +54420,7 @@ class NestedGroup {
|
|
|
54420
54420
|
return group;
|
|
54421
54421
|
}
|
|
54422
54422
|
|
|
54423
|
-
renderShape(shape, color, alpha, renderback, name, states) {
|
|
54423
|
+
renderShape(shape, color, alpha, renderback, path, name, states) {
|
|
54424
54424
|
const positions =
|
|
54425
54425
|
shape.vertices instanceof Float32Array
|
|
54426
54426
|
? shape.vertices
|
|
@@ -54441,6 +54441,10 @@ class NestedGroup {
|
|
|
54441
54441
|
renderback,
|
|
54442
54442
|
);
|
|
54443
54443
|
|
|
54444
|
+
path = path + this.delim + name;
|
|
54445
|
+
this.groups[path.replaceAll(this.delim, "/")] = group;
|
|
54446
|
+
group.name = path;
|
|
54447
|
+
|
|
54444
54448
|
if (alpha == null) {
|
|
54445
54449
|
alpha = 1.0;
|
|
54446
54450
|
} else if (alpha < 1.0) {
|
|
@@ -54554,6 +54558,7 @@ class NestedGroup {
|
|
|
54554
54558
|
shape.color,
|
|
54555
54559
|
shape.alpha,
|
|
54556
54560
|
shape.renderback == null ? false : shape.renderback,
|
|
54561
|
+
path,
|
|
54557
54562
|
shape.name,
|
|
54558
54563
|
states[shape.id],
|
|
54559
54564
|
);
|
|
@@ -57891,7 +57896,7 @@ class Camera {
|
|
|
57891
57896
|
}
|
|
57892
57897
|
}
|
|
57893
57898
|
|
|
57894
|
-
const version="1.7.
|
|
57899
|
+
const version="1.7.6";
|
|
57895
57900
|
|
|
57896
57901
|
class Viewer {
|
|
57897
57902
|
/**
|
|
@@ -59708,7 +59713,7 @@ class Viewer {
|
|
|
59708
59713
|
* @param {number} [speed=1] - speed of animation.
|
|
59709
59714
|
* @param {number} [multiplier=2.5] - multiplier for length of trajectories.
|
|
59710
59715
|
*/
|
|
59711
|
-
explode(duration = 2, speed = 1, multiplier = 2.
|
|
59716
|
+
explode(duration = 2, speed = 1, multiplier = 2.0) {
|
|
59712
59717
|
this.clearAnimation();
|
|
59713
59718
|
|
|
59714
59719
|
const use_origin = this.getAxes0();
|
|
@@ -59727,42 +59732,41 @@ class Viewer {
|
|
|
59727
59732
|
|
|
59728
59733
|
for (var id in this.nestedGroup.groups) {
|
|
59729
59734
|
// Loop over all Group elements
|
|
59730
|
-
|
|
59731
|
-
var group = this.nestedGroup.groups[id];
|
|
59735
|
+
var group = this.nestedGroup.groups[id];
|
|
59732
59736
|
|
|
59733
|
-
|
|
59734
|
-
|
|
59735
|
-
|
|
59736
|
-
|
|
59737
|
+
var b = new Box3();
|
|
59738
|
+
if (group instanceof ObjectGroup) {
|
|
59739
|
+
b.expandByObject(group);
|
|
59740
|
+
} else {
|
|
59737
59741
|
group.children.forEach((child) => {
|
|
59738
59742
|
if (child instanceof ObjectGroup) {
|
|
59739
59743
|
b.expandByObject(child);
|
|
59740
59744
|
}
|
|
59741
59745
|
});
|
|
59742
|
-
|
|
59743
|
-
|
|
59744
|
-
|
|
59745
|
-
|
|
59746
|
+
}
|
|
59747
|
+
if (b.isEmpty()) {
|
|
59748
|
+
continue;
|
|
59749
|
+
}
|
|
59750
|
+
b.getCenter(worldObjectCenter);
|
|
59746
59751
|
|
|
59747
|
-
|
|
59748
|
-
|
|
59749
|
-
|
|
59752
|
+
// Explode around global center or origin
|
|
59753
|
+
worldDirection = worldObjectCenter.sub(worldCenterOrOrigin);
|
|
59754
|
+
localDirection = group.parent.worldToLocal(worldDirection.clone());
|
|
59750
59755
|
|
|
59751
|
-
|
|
59752
|
-
|
|
59753
|
-
|
|
59754
|
-
|
|
59755
|
-
|
|
59756
|
-
|
|
59757
|
-
|
|
59758
|
-
|
|
59759
|
-
|
|
59760
|
-
|
|
59761
|
-
|
|
59762
|
-
|
|
59763
|
-
|
|
59764
|
-
|
|
59765
|
-
}
|
|
59756
|
+
// Use the parent to calculate the local directions
|
|
59757
|
+
scaledLocalDirection = group.parent.worldToLocal(
|
|
59758
|
+
worldDirection.clone().multiplyScalar(multiplier),
|
|
59759
|
+
);
|
|
59760
|
+
// and ensure to shift objects at its center and not at its position
|
|
59761
|
+
scaledLocalDirection.sub(localDirection);
|
|
59762
|
+
|
|
59763
|
+
// build an animation track for the group with this direction
|
|
59764
|
+
this.addAnimationTrack(
|
|
59765
|
+
id,
|
|
59766
|
+
"t",
|
|
59767
|
+
[0, duration],
|
|
59768
|
+
[[0, 0, 0], scaledLocalDirection.toArray()],
|
|
59769
|
+
);
|
|
59766
59770
|
}
|
|
59767
59771
|
this.initAnimation(duration, speed, "E", false);
|
|
59768
59772
|
}
|