@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/index.cjs CHANGED
@@ -6149,6 +6149,16 @@ var ThreeDPlugin = class {
6149
6149
  type: "button",
6150
6150
  group: "actions",
6151
6151
  execute: () => instance.download?.()
6152
+ },
6153
+ {
6154
+ id: "open-window",
6155
+ icon: "open-window",
6156
+ label: "Open in Separate Full Window",
6157
+ type: "button",
6158
+ group: "actions",
6159
+ execute: () => {
6160
+ instance.openInSeparateWindow?.();
6161
+ }
6152
6162
  }
6153
6163
  ];
6154
6164
  }
@@ -6219,12 +6229,21 @@ var ThreeDPlugin = class {
6219
6229
  });
6220
6230
  meshGroup.add(obj);
6221
6231
  }
6232
+ const initialBox = new THREE__namespace.Box3().setFromObject(meshGroup);
6233
+ const center = initialBox.getCenter(new THREE__namespace.Vector3());
6234
+ meshGroup.position.sub(center);
6222
6235
  scene.add(meshGroup);
6223
6236
  const box = new THREE__namespace.Box3().setFromObject(meshGroup);
6224
- const sphere = box.getBoundingSphere(new THREE__namespace.Sphere());
6225
- const radius = Math.max(sphere.radius, 10);
6237
+ const size = box.getSize(new THREE__namespace.Vector3());
6238
+ const maxDim = Math.max(size.x, size.y, size.z) || 10;
6239
+ grid.position.y = -size.y / 2;
6240
+ const gridScale = Math.max(0.1, maxDim / 50);
6241
+ grid.scale.set(gridScale, 1, gridScale);
6242
+ const fovRad = camera.fov * (Math.PI / 180);
6243
+ let cameraDistance = maxDim / 2 / Math.tan(fovRad / 2);
6244
+ cameraDistance = Math.max(cameraDistance * 1.5, 2);
6226
6245
  const fitCamera = () => {
6227
- camera.position.set(radius * 1.5, radius * 1.2, radius * 2);
6246
+ camera.position.set(cameraDistance * 0.8, cameraDistance * 0.6, cameraDistance);
6228
6247
  camera.lookAt(0, 0, 0);
6229
6248
  controls.target.set(0, 0, 0);
6230
6249
  controls.update();
@@ -6270,6 +6289,7 @@ var ThreeDPlugin = class {
6270
6289
  controls.update();
6271
6290
  },
6272
6291
  fitToPage: fitCamera,
6292
+ fitToWidth: fitCamera,
6273
6293
  resetZoom: fitCamera,
6274
6294
  rotateCW: () => {
6275
6295
  isWireframe = !isWireframe;