@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.js CHANGED
@@ -6118,6 +6118,16 @@ var ThreeDPlugin = class {
6118
6118
  type: "button",
6119
6119
  group: "actions",
6120
6120
  execute: () => instance.download?.()
6121
+ },
6122
+ {
6123
+ id: "open-window",
6124
+ icon: "open-window",
6125
+ label: "Open in Separate Full Window",
6126
+ type: "button",
6127
+ group: "actions",
6128
+ execute: () => {
6129
+ instance.openInSeparateWindow?.();
6130
+ }
6121
6131
  }
6122
6132
  ];
6123
6133
  }
@@ -6188,12 +6198,21 @@ var ThreeDPlugin = class {
6188
6198
  });
6189
6199
  meshGroup.add(obj);
6190
6200
  }
6201
+ const initialBox = new THREE.Box3().setFromObject(meshGroup);
6202
+ const center = initialBox.getCenter(new THREE.Vector3());
6203
+ meshGroup.position.sub(center);
6191
6204
  scene.add(meshGroup);
6192
6205
  const box = new THREE.Box3().setFromObject(meshGroup);
6193
- const sphere = box.getBoundingSphere(new THREE.Sphere());
6194
- const radius = Math.max(sphere.radius, 10);
6206
+ const size = box.getSize(new THREE.Vector3());
6207
+ const maxDim = Math.max(size.x, size.y, size.z) || 10;
6208
+ grid.position.y = -size.y / 2;
6209
+ const gridScale = Math.max(0.1, maxDim / 50);
6210
+ grid.scale.set(gridScale, 1, gridScale);
6211
+ const fovRad = camera.fov * (Math.PI / 180);
6212
+ let cameraDistance = maxDim / 2 / Math.tan(fovRad / 2);
6213
+ cameraDistance = Math.max(cameraDistance * 1.5, 2);
6195
6214
  const fitCamera = () => {
6196
- camera.position.set(radius * 1.5, radius * 1.2, radius * 2);
6215
+ camera.position.set(cameraDistance * 0.8, cameraDistance * 0.6, cameraDistance);
6197
6216
  camera.lookAt(0, 0, 0);
6198
6217
  controls.target.set(0, 0, 0);
6199
6218
  controls.update();
@@ -6239,6 +6258,7 @@ var ThreeDPlugin = class {
6239
6258
  controls.update();
6240
6259
  },
6241
6260
  fitToPage: fitCamera,
6261
+ fitToWidth: fitCamera,
6242
6262
  resetZoom: fitCamera,
6243
6263
  rotateCW: () => {
6244
6264
  isWireframe = !isWireframe;