@files-preview-app/preview-file 1.3.10 → 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/angular.cjs +63 -18
- package/dist/angular.cjs.map +1 -1
- package/dist/angular.js +63 -18
- package/dist/angular.js.map +1 -1
- package/dist/index.cjs +63 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +63 -18
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +63 -18
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +63 -18
- package/dist/react.js.map +1 -1
- package/dist/vue.cjs +63 -18
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.d.cts +2 -2
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js +63 -18
- package/dist/vue.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2801,13 +2801,28 @@ var MediaPlugin = class {
|
|
|
2801
2801
|
video.src = url;
|
|
2802
2802
|
video.controls = true;
|
|
2803
2803
|
video.playsInline = true;
|
|
2804
|
-
video.style.maxWidth = "90%";
|
|
2805
|
-
video.style.maxHeight = "90%";
|
|
2806
2804
|
video.style.borderRadius = "8px";
|
|
2807
2805
|
video.style.boxShadow = "0 8px 30px rgba(0,0,0,0.3)";
|
|
2808
2806
|
video.style.backgroundColor = "#000000";
|
|
2807
|
+
video.style.objectFit = "contain";
|
|
2808
|
+
video.style.transition = "transform 0.2s ease";
|
|
2809
2809
|
element = video;
|
|
2810
2810
|
mediaElement = video;
|
|
2811
|
+
const onMeta = () => {
|
|
2812
|
+
if (video.videoWidth > 0 && video.videoHeight > 0) {
|
|
2813
|
+
naturalW = video.videoWidth;
|
|
2814
|
+
naturalH = video.videoHeight;
|
|
2815
|
+
}
|
|
2816
|
+
updateBaseDimensions();
|
|
2817
|
+
applyTransform();
|
|
2818
|
+
};
|
|
2819
|
+
if (video.readyState >= 1 && video.videoWidth > 0) {
|
|
2820
|
+
naturalW = video.videoWidth;
|
|
2821
|
+
naturalH = video.videoHeight;
|
|
2822
|
+
} else {
|
|
2823
|
+
video.addEventListener("loadedmetadata", onMeta, { once: true });
|
|
2824
|
+
video.addEventListener("canplay", onMeta, { once: true });
|
|
2825
|
+
}
|
|
2811
2826
|
} else if (isAudio) {
|
|
2812
2827
|
const audio = document.createElement("audio");
|
|
2813
2828
|
audio.src = url;
|
|
@@ -2848,11 +2863,19 @@ var MediaPlugin = class {
|
|
|
2848
2863
|
let fitMode = ctx?.options?.fitMode || "width";
|
|
2849
2864
|
let isUserZoomed = false;
|
|
2850
2865
|
const updateBaseDimensions = () => {
|
|
2851
|
-
if (!isImage) return;
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2866
|
+
if (!isImage && !isVideo) return;
|
|
2867
|
+
if (isImage) {
|
|
2868
|
+
const img = element;
|
|
2869
|
+
if (img.naturalWidth > 0 && img.naturalHeight > 0) {
|
|
2870
|
+
naturalW = img.naturalWidth;
|
|
2871
|
+
naturalH = img.naturalHeight;
|
|
2872
|
+
}
|
|
2873
|
+
} else if (isVideo) {
|
|
2874
|
+
const vid = element;
|
|
2875
|
+
if (vid.videoWidth > 0 && vid.videoHeight > 0) {
|
|
2876
|
+
naturalW = vid.videoWidth;
|
|
2877
|
+
naturalH = vid.videoHeight;
|
|
2878
|
+
}
|
|
2856
2879
|
}
|
|
2857
2880
|
const availW = Math.max(100, ctx.container.clientWidth - 32);
|
|
2858
2881
|
const availH = Math.max(100, ctx.container.clientHeight - 32);
|
|
@@ -2866,7 +2889,7 @@ var MediaPlugin = class {
|
|
|
2866
2889
|
baseH = Math.max(1, Math.round(naturalH * fitRatio));
|
|
2867
2890
|
};
|
|
2868
2891
|
const applyTransform = () => {
|
|
2869
|
-
if (isImage) {
|
|
2892
|
+
if (isImage || isVideo) {
|
|
2870
2893
|
if (!isUserZoomed) {
|
|
2871
2894
|
updateBaseDimensions();
|
|
2872
2895
|
}
|
|
@@ -2877,10 +2900,10 @@ var MediaPlugin = class {
|
|
|
2877
2900
|
sizer.style.width = `${boxW}px`;
|
|
2878
2901
|
sizer.style.height = `${boxH}px`;
|
|
2879
2902
|
sizer.style.margin = boxH < availH ? "auto 0" : "0";
|
|
2880
|
-
const
|
|
2881
|
-
const
|
|
2882
|
-
element.style.width = `${
|
|
2883
|
-
element.style.height = `${
|
|
2903
|
+
const elW = isRotated90 ? boxH : boxW;
|
|
2904
|
+
const elH = isRotated90 ? boxW : boxH;
|
|
2905
|
+
element.style.width = `${elW}px`;
|
|
2906
|
+
element.style.height = `${elH}px`;
|
|
2884
2907
|
element.style.maxWidth = "none";
|
|
2885
2908
|
element.style.maxHeight = "none";
|
|
2886
2909
|
element.style.transform = rotation ? `rotate(${rotation}deg)` : "none";
|
|
@@ -2890,6 +2913,8 @@ var MediaPlugin = class {
|
|
|
2890
2913
|
element.style.transform = `scale(${currentZoom}) rotate(${rotation}deg)`;
|
|
2891
2914
|
}
|
|
2892
2915
|
};
|
|
2916
|
+
updateBaseDimensions();
|
|
2917
|
+
applyTransform();
|
|
2893
2918
|
if (isImage) {
|
|
2894
2919
|
const img = element;
|
|
2895
2920
|
if (img.complete && img.naturalWidth > 0) {
|
|
@@ -2934,7 +2959,7 @@ var MediaPlugin = class {
|
|
|
2934
2959
|
currentZoom = level;
|
|
2935
2960
|
applyTransform();
|
|
2936
2961
|
} : void 0,
|
|
2937
|
-
fitToPage: isImage ? () => {
|
|
2962
|
+
fitToPage: isImage || isVideo ? () => {
|
|
2938
2963
|
isUserZoomed = false;
|
|
2939
2964
|
fitMode = "page";
|
|
2940
2965
|
currentZoom = 1;
|
|
@@ -2944,7 +2969,7 @@ var MediaPlugin = class {
|
|
|
2944
2969
|
updateBaseDimensions();
|
|
2945
2970
|
applyTransform();
|
|
2946
2971
|
} : void 0,
|
|
2947
|
-
fitToWidth: isImage ? () => {
|
|
2972
|
+
fitToWidth: isImage || isVideo ? () => {
|
|
2948
2973
|
isUserZoomed = false;
|
|
2949
2974
|
fitMode = "width";
|
|
2950
2975
|
currentZoom = 1;
|
|
@@ -2954,7 +2979,7 @@ var MediaPlugin = class {
|
|
|
2954
2979
|
updateBaseDimensions();
|
|
2955
2980
|
applyTransform();
|
|
2956
2981
|
} : void 0,
|
|
2957
|
-
resetZoom: isImage ? () => {
|
|
2982
|
+
resetZoom: isImage || isVideo ? () => {
|
|
2958
2983
|
isUserZoomed = false;
|
|
2959
2984
|
fitMode = ctx?.options?.fitMode || "width";
|
|
2960
2985
|
currentZoom = 1;
|
|
@@ -6093,6 +6118,16 @@ var ThreeDPlugin = class {
|
|
|
6093
6118
|
type: "button",
|
|
6094
6119
|
group: "actions",
|
|
6095
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
|
+
}
|
|
6096
6131
|
}
|
|
6097
6132
|
];
|
|
6098
6133
|
}
|
|
@@ -6163,12 +6198,21 @@ var ThreeDPlugin = class {
|
|
|
6163
6198
|
});
|
|
6164
6199
|
meshGroup.add(obj);
|
|
6165
6200
|
}
|
|
6201
|
+
const initialBox = new THREE.Box3().setFromObject(meshGroup);
|
|
6202
|
+
const center = initialBox.getCenter(new THREE.Vector3());
|
|
6203
|
+
meshGroup.position.sub(center);
|
|
6166
6204
|
scene.add(meshGroup);
|
|
6167
6205
|
const box = new THREE.Box3().setFromObject(meshGroup);
|
|
6168
|
-
const
|
|
6169
|
-
const
|
|
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);
|
|
6170
6214
|
const fitCamera = () => {
|
|
6171
|
-
camera.position.set(
|
|
6215
|
+
camera.position.set(cameraDistance * 0.8, cameraDistance * 0.6, cameraDistance);
|
|
6172
6216
|
camera.lookAt(0, 0, 0);
|
|
6173
6217
|
controls.target.set(0, 0, 0);
|
|
6174
6218
|
controls.update();
|
|
@@ -6214,6 +6258,7 @@ var ThreeDPlugin = class {
|
|
|
6214
6258
|
controls.update();
|
|
6215
6259
|
},
|
|
6216
6260
|
fitToPage: fitCamera,
|
|
6261
|
+
fitToWidth: fitCamera,
|
|
6217
6262
|
resetZoom: fitCamera,
|
|
6218
6263
|
rotateCW: () => {
|
|
6219
6264
|
isWireframe = !isWireframe;
|