@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.cjs CHANGED
@@ -6068,6 +6068,16 @@ var ThreeDPlugin = class {
6068
6068
  type: "button",
6069
6069
  group: "actions",
6070
6070
  execute: () => instance.download?.()
6071
+ },
6072
+ {
6073
+ id: "open-window",
6074
+ icon: "open-window",
6075
+ label: "Open in Separate Full Window",
6076
+ type: "button",
6077
+ group: "actions",
6078
+ execute: () => {
6079
+ instance.openInSeparateWindow?.();
6080
+ }
6071
6081
  }
6072
6082
  ];
6073
6083
  }
@@ -6138,12 +6148,21 @@ var ThreeDPlugin = class {
6138
6148
  });
6139
6149
  meshGroup.add(obj);
6140
6150
  }
6151
+ const initialBox = new THREE__namespace.Box3().setFromObject(meshGroup);
6152
+ const center = initialBox.getCenter(new THREE__namespace.Vector3());
6153
+ meshGroup.position.sub(center);
6141
6154
  scene.add(meshGroup);
6142
6155
  const box = new THREE__namespace.Box3().setFromObject(meshGroup);
6143
- const sphere = box.getBoundingSphere(new THREE__namespace.Sphere());
6144
- const radius = Math.max(sphere.radius, 10);
6156
+ const size = box.getSize(new THREE__namespace.Vector3());
6157
+ const maxDim = Math.max(size.x, size.y, size.z) || 10;
6158
+ grid.position.y = -size.y / 2;
6159
+ const gridScale = Math.max(0.1, maxDim / 50);
6160
+ grid.scale.set(gridScale, 1, gridScale);
6161
+ const fovRad = camera.fov * (Math.PI / 180);
6162
+ let cameraDistance = maxDim / 2 / Math.tan(fovRad / 2);
6163
+ cameraDistance = Math.max(cameraDistance * 1.5, 2);
6145
6164
  const fitCamera = () => {
6146
- camera.position.set(radius * 1.5, radius * 1.2, radius * 2);
6165
+ camera.position.set(cameraDistance * 0.8, cameraDistance * 0.6, cameraDistance);
6147
6166
  camera.lookAt(0, 0, 0);
6148
6167
  controls.target.set(0, 0, 0);
6149
6168
  controls.update();
@@ -6189,6 +6208,7 @@ var ThreeDPlugin = class {
6189
6208
  controls.update();
6190
6209
  },
6191
6210
  fitToPage: fitCamera,
6211
+ fitToWidth: fitCamera,
6192
6212
  resetZoom: fitCamera,
6193
6213
  rotateCW: () => {
6194
6214
  isWireframe = !isWireframe;