@inweb/viewer-three 26.9.5 → 26.9.7
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/viewer-three.js +37 -29
- package/dist/viewer-three.js.map +1 -1
- package/dist/viewer-three.min.js +3 -3
- package/dist/viewer-three.module.js +37 -29
- package/dist/viewer-three.module.js.map +1 -1
- package/lib/Viewer/components/ResetComponent.d.ts +10 -0
- package/lib/Viewer/controls/WalkControls.d.ts +1 -8
- package/package.json +5 -5
- package/src/Viewer/commands/ResetView.ts +5 -1
- package/src/Viewer/components/ResetComponent.ts +64 -0
- package/src/Viewer/components/index.ts +2 -0
- package/src/Viewer/controls/WalkControls.ts +3 -35
- package/src/Viewer/draggers/WalkDragger.ts +7 -7
package/dist/viewer-three.js
CHANGED
|
@@ -34182,7 +34182,7 @@ void main() {
|
|
|
34182
34182
|
}
|
|
34183
34183
|
|
|
34184
34184
|
class WalkControls extends Controls {
|
|
34185
|
-
constructor(camera, canvas, groundObjects
|
|
34185
|
+
constructor(camera, canvas, groundObjects) {
|
|
34186
34186
|
super(camera, canvas);
|
|
34187
34187
|
this.EYE_HEIGHT = 1.7;
|
|
34188
34188
|
this.FAILING_DISTANCE = 2;
|
|
@@ -34258,11 +34258,7 @@ void main() {
|
|
|
34258
34258
|
if (this.moveKeys.delete(event.code))
|
|
34259
34259
|
this.update();
|
|
34260
34260
|
};
|
|
34261
|
-
this.initHighlighter = () => {
|
|
34262
|
-
this.highlighter = this.viewer.getComponent("HighlighterComponent");
|
|
34263
|
-
};
|
|
34264
34261
|
this.camera = camera;
|
|
34265
|
-
this.viewer = viewer;
|
|
34266
34262
|
this.groundObjects = groundObjects;
|
|
34267
34263
|
this.raycaster = new Raycaster();
|
|
34268
34264
|
this.raycaster.near = 0;
|
|
@@ -34291,7 +34287,8 @@ void main() {
|
|
|
34291
34287
|
super.dispose();
|
|
34292
34288
|
}
|
|
34293
34289
|
updateGroundFollowing() {
|
|
34294
|
-
|
|
34290
|
+
const up = new Vector3().copy(this.camera.up);
|
|
34291
|
+
this.raycaster.set(this.object.position, up.negate());
|
|
34295
34292
|
this.raycaster.params = this.raycaster.params = {
|
|
34296
34293
|
Mesh: {},
|
|
34297
34294
|
Line: { threshold: 0 },
|
|
@@ -34307,20 +34304,6 @@ void main() {
|
|
|
34307
34304
|
this.object.position.y = MathUtils.lerp(this.object.position.y, targetY, this.GROUND_FOLLOWING_SPEED);
|
|
34308
34305
|
}
|
|
34309
34306
|
}
|
|
34310
|
-
select(objects, model) {
|
|
34311
|
-
if (!model) {
|
|
34312
|
-
this.viewer.models.forEach((model) => this.select(objects, model));
|
|
34313
|
-
return;
|
|
34314
|
-
}
|
|
34315
|
-
if (!Array.isArray(objects))
|
|
34316
|
-
objects = [objects];
|
|
34317
|
-
if (!objects.length)
|
|
34318
|
-
return;
|
|
34319
|
-
model.showOriginalObjects(objects);
|
|
34320
|
-
this.highlighter.highlight(objects);
|
|
34321
|
-
objects.forEach((object) => this.viewer.selected.push(object));
|
|
34322
|
-
objects.forEach((object) => (object.isSelected = true));
|
|
34323
|
-
}
|
|
34324
34307
|
update() {
|
|
34325
34308
|
let moved = false;
|
|
34326
34309
|
let upgradeGroundFollowing = false;
|
|
@@ -34420,14 +34403,12 @@ void main() {
|
|
|
34420
34403
|
this.controls.rotateDelta.set(0, 0);
|
|
34421
34404
|
};
|
|
34422
34405
|
const meshOnlyGround = [];
|
|
34423
|
-
viewer.models
|
|
34424
|
-
obj
|
|
34425
|
-
|
|
34426
|
-
|
|
34427
|
-
|
|
34428
|
-
|
|
34429
|
-
});
|
|
34430
|
-
this.controls = new WalkControls(viewer.camera, viewer.canvas, meshOnlyGround, viewer);
|
|
34406
|
+
viewer.models.forEach((model) => model.getVisibleObjects().forEach((obj) => {
|
|
34407
|
+
if (obj instanceof Mesh) {
|
|
34408
|
+
meshOnlyGround.push(obj);
|
|
34409
|
+
}
|
|
34410
|
+
}));
|
|
34411
|
+
this.controls = new WalkControls(viewer.camera, viewer.canvas, meshOnlyGround);
|
|
34431
34412
|
this.controls.addEventListener("change", this.controlsChange);
|
|
34432
34413
|
this.controls.addEventListener("walkspeedchange", this.walkspeedChange);
|
|
34433
34414
|
this.viewer = viewer;
|
|
@@ -34775,6 +34756,7 @@ void main() {
|
|
|
34775
34756
|
}
|
|
34776
34757
|
|
|
34777
34758
|
function resetView(viewer) {
|
|
34759
|
+
const reset = viewer.getComponent("ResetComponent");
|
|
34778
34760
|
viewer.executeCommand("setActiveDragger");
|
|
34779
34761
|
viewer.executeCommand("clearSlices");
|
|
34780
34762
|
viewer.executeCommand("clearOverlay");
|
|
@@ -34783,7 +34765,7 @@ void main() {
|
|
|
34783
34765
|
viewer.executeCommand("showAll");
|
|
34784
34766
|
viewer.executeCommand("explode", 0);
|
|
34785
34767
|
viewer.executeCommand("zoomToExtents", true);
|
|
34786
|
-
|
|
34768
|
+
reset.resetCameraPosition();
|
|
34787
34769
|
viewer.emit({ type: "resetview" });
|
|
34788
34770
|
}
|
|
34789
34771
|
|
|
@@ -36160,6 +36142,31 @@ void main() {
|
|
|
36160
36142
|
}
|
|
36161
36143
|
}
|
|
36162
36144
|
|
|
36145
|
+
class ResetComponent {
|
|
36146
|
+
constructor(viewer) {
|
|
36147
|
+
this.savedCameraPosition = null;
|
|
36148
|
+
this.onDatabaseChunk = () => {
|
|
36149
|
+
this.savedCameraPosition = {
|
|
36150
|
+
position: this.viewer.camera.position.clone(),
|
|
36151
|
+
up: this.viewer.camera.up.clone(),
|
|
36152
|
+
direction: this.viewer.camera.getWorldDirection(new Vector3()),
|
|
36153
|
+
};
|
|
36154
|
+
};
|
|
36155
|
+
this.viewer = viewer;
|
|
36156
|
+
this.viewer.addEventListener("databasechunk", this.onDatabaseChunk);
|
|
36157
|
+
}
|
|
36158
|
+
dispose() {
|
|
36159
|
+
this.viewer.removeEventListener("databasechunk", this.onDatabaseChunk);
|
|
36160
|
+
}
|
|
36161
|
+
resetCameraPosition() {
|
|
36162
|
+
if (this.savedCameraPosition) {
|
|
36163
|
+
this.viewer.camera.position.copy(this.savedCameraPosition.position);
|
|
36164
|
+
this.viewer.camera.up.copy(this.savedCameraPosition.up);
|
|
36165
|
+
this.viewer.camera.lookAt(this.savedCameraPosition.position.clone().add(this.savedCameraPosition.direction));
|
|
36166
|
+
}
|
|
36167
|
+
}
|
|
36168
|
+
}
|
|
36169
|
+
|
|
36163
36170
|
const components = componentsRegistry("threejs");
|
|
36164
36171
|
components.registerComponent("ExtentsComponent", (viewer) => new ExtentsComponent(viewer));
|
|
36165
36172
|
components.registerComponent("CameraComponent", (viewer) => new CameraComponent(viewer));
|
|
@@ -36170,6 +36177,7 @@ void main() {
|
|
|
36170
36177
|
components.registerComponent("HighlighterComponent", (viewer) => new HighlighterComponent(viewer));
|
|
36171
36178
|
components.registerComponent("SelectionComponent", (viewer) => new SelectionComponent(viewer));
|
|
36172
36179
|
components.registerComponent("WCSHelperComponent", (viewer) => new WCSHelperComponent(viewer));
|
|
36180
|
+
components.registerComponent("ResetComponent", (viewer) => new ResetComponent(viewer));
|
|
36173
36181
|
|
|
36174
36182
|
function mergeGeometries( geometries, useGroups = false ) {
|
|
36175
36183
|
const isIndexed = geometries[ 0 ].index !== null;
|