@files-preview-app/preview-file 1.3.11 → 1.3.12

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/react.js CHANGED
@@ -6035,6 +6035,16 @@ var ThreeDPlugin = class {
6035
6035
  type: "button",
6036
6036
  group: "actions",
6037
6037
  execute: () => instance.download?.()
6038
+ },
6039
+ {
6040
+ id: "open-window",
6041
+ icon: "open-window",
6042
+ label: "Open in Separate Full Window",
6043
+ type: "button",
6044
+ group: "actions",
6045
+ execute: () => {
6046
+ instance.openInSeparateWindow?.();
6047
+ }
6038
6048
  }
6039
6049
  ];
6040
6050
  }
@@ -6105,12 +6115,21 @@ var ThreeDPlugin = class {
6105
6115
  });
6106
6116
  meshGroup.add(obj);
6107
6117
  }
6118
+ const initialBox = new THREE.Box3().setFromObject(meshGroup);
6119
+ const center = initialBox.getCenter(new THREE.Vector3());
6120
+ meshGroup.position.sub(center);
6108
6121
  scene.add(meshGroup);
6109
6122
  const box = new THREE.Box3().setFromObject(meshGroup);
6110
- const sphere = box.getBoundingSphere(new THREE.Sphere());
6111
- const radius = Math.max(sphere.radius, 10);
6123
+ const size = box.getSize(new THREE.Vector3());
6124
+ const maxDim = Math.max(size.x, size.y, size.z) || 10;
6125
+ grid.position.y = -size.y / 2;
6126
+ const gridScale = Math.max(0.1, maxDim / 50);
6127
+ grid.scale.set(gridScale, 1, gridScale);
6128
+ const fovRad = camera.fov * (Math.PI / 180);
6129
+ let cameraDistance = maxDim / 2 / Math.tan(fovRad / 2);
6130
+ cameraDistance = Math.max(cameraDistance * 1.5, 2);
6112
6131
  const fitCamera = () => {
6113
- camera.position.set(radius * 1.5, radius * 1.2, radius * 2);
6132
+ camera.position.set(cameraDistance * 0.8, cameraDistance * 0.6, cameraDistance);
6114
6133
  camera.lookAt(0, 0, 0);
6115
6134
  controls.target.set(0, 0, 0);
6116
6135
  controls.update();
@@ -6156,6 +6175,7 @@ var ThreeDPlugin = class {
6156
6175
  controls.update();
6157
6176
  },
6158
6177
  fitToPage: fitCamera,
6178
+ fitToWidth: fitCamera,
6159
6179
  resetZoom: fitCamera,
6160
6180
  rotateCW: () => {
6161
6181
  isWireframe = !isWireframe;