@inweb/viewer-three 26.9.6 → 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 +28 -1
- package/dist/viewer-three.js.map +1 -1
- package/dist/viewer-three.min.js +3 -3
- package/dist/viewer-three.module.js +28 -1
- package/dist/viewer-three.module.js.map +1 -1
- package/lib/Viewer/components/ResetComponent.d.ts +10 -0
- 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/dist/viewer-three.js
CHANGED
|
@@ -34756,6 +34756,7 @@ void main() {
|
|
|
34756
34756
|
}
|
|
34757
34757
|
|
|
34758
34758
|
function resetView(viewer) {
|
|
34759
|
+
const reset = viewer.getComponent("ResetComponent");
|
|
34759
34760
|
viewer.executeCommand("setActiveDragger");
|
|
34760
34761
|
viewer.executeCommand("clearSlices");
|
|
34761
34762
|
viewer.executeCommand("clearOverlay");
|
|
@@ -34764,7 +34765,7 @@ void main() {
|
|
|
34764
34765
|
viewer.executeCommand("showAll");
|
|
34765
34766
|
viewer.executeCommand("explode", 0);
|
|
34766
34767
|
viewer.executeCommand("zoomToExtents", true);
|
|
34767
|
-
|
|
34768
|
+
reset.resetCameraPosition();
|
|
34768
34769
|
viewer.emit({ type: "resetview" });
|
|
34769
34770
|
}
|
|
34770
34771
|
|
|
@@ -36141,6 +36142,31 @@ void main() {
|
|
|
36141
36142
|
}
|
|
36142
36143
|
}
|
|
36143
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
|
+
|
|
36144
36170
|
const components = componentsRegistry("threejs");
|
|
36145
36171
|
components.registerComponent("ExtentsComponent", (viewer) => new ExtentsComponent(viewer));
|
|
36146
36172
|
components.registerComponent("CameraComponent", (viewer) => new CameraComponent(viewer));
|
|
@@ -36151,6 +36177,7 @@ void main() {
|
|
|
36151
36177
|
components.registerComponent("HighlighterComponent", (viewer) => new HighlighterComponent(viewer));
|
|
36152
36178
|
components.registerComponent("SelectionComponent", (viewer) => new SelectionComponent(viewer));
|
|
36153
36179
|
components.registerComponent("WCSHelperComponent", (viewer) => new WCSHelperComponent(viewer));
|
|
36180
|
+
components.registerComponent("ResetComponent", (viewer) => new ResetComponent(viewer));
|
|
36154
36181
|
|
|
36155
36182
|
function mergeGeometries( geometries, useGroups = false ) {
|
|
36156
36183
|
const isIndexed = geometries[ 0 ].index !== null;
|