@koi-br/ocr-web-sdk 1.0.34 → 1.0.35
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-DK33Dz9M.js → index-CKWQDPoP.js} +38 -38
- package/dist/{index-DXnzd_-3.mjs → index-Dx9CNRoV.mjs} +765 -761
- package/dist/index.cjs.js +2 -2
- package/dist/index.esm.js +2 -2
- package/dist/{tiff.min-x7pMh_Bz.mjs → tiff.min-B8vWRefT.mjs} +1 -1
- package/dist/{tiff.min-Bbzmyg2R.js → tiff.min-D5eSYpnb.js} +1 -1
- package/package.json +1 -1
- package/preview/ImagePreview.vue +25 -6
package/package.json
CHANGED
package/preview/ImagePreview.vue
CHANGED
|
@@ -2222,18 +2222,31 @@ const handleContainerResize = () => {
|
|
|
2222
2222
|
return;
|
|
2223
2223
|
}
|
|
2224
2224
|
|
|
2225
|
-
//
|
|
2225
|
+
// 清除之前的定时器
|
|
2226
2226
|
if (resizeTimer) {
|
|
2227
2227
|
clearTimeout(resizeTimer);
|
|
2228
|
+
resizeTimer = null;
|
|
2228
2229
|
}
|
|
2229
2230
|
|
|
2230
|
-
|
|
2231
|
+
// 立即计算并应用新的缩放比例,避免过渡期间露出底色
|
|
2232
|
+
// 使用 requestAnimationFrame 确保在浏览器重绘前更新
|
|
2233
|
+
requestAnimationFrame(() => {
|
|
2231
2234
|
const newScale = calculateAutoFitScale();
|
|
2232
|
-
if (newScale > 0
|
|
2235
|
+
if (newScale > 0) {
|
|
2236
|
+
// 即使变化很小也立即更新,确保过渡期间图片始终填满容器
|
|
2233
2237
|
scale.value = newScale;
|
|
2234
2238
|
initialAutoFitScale.value = newScale;
|
|
2235
2239
|
}
|
|
2236
|
-
|
|
2240
|
+
|
|
2241
|
+
// 在过渡动画完成后再次检查,确保最终状态正确(处理过渡动画期间的连续变化)
|
|
2242
|
+
resizeTimer = setTimeout(() => {
|
|
2243
|
+
const finalScale = calculateAutoFitScale();
|
|
2244
|
+
if (finalScale > 0 && Math.abs(finalScale - scale.value) > 0.01) {
|
|
2245
|
+
scale.value = finalScale;
|
|
2246
|
+
initialAutoFitScale.value = finalScale;
|
|
2247
|
+
}
|
|
2248
|
+
}, 350); // 350ms 延迟,略大于过渡动画时间(300ms),确保过渡完成后稳定
|
|
2249
|
+
});
|
|
2237
2250
|
};
|
|
2238
2251
|
|
|
2239
2252
|
/**
|
|
@@ -2262,8 +2275,12 @@ onMounted(() => {
|
|
|
2262
2275
|
// 监听容器尺寸变化(用于响应外部收起/展开操作)
|
|
2263
2276
|
nextTick(() => {
|
|
2264
2277
|
if (containerRef.value && typeof ResizeObserver !== 'undefined') {
|
|
2265
|
-
resizeObserver = new ResizeObserver(() => {
|
|
2266
|
-
|
|
2278
|
+
resizeObserver = new ResizeObserver((entries) => {
|
|
2279
|
+
// 使用 entries 参数立即获取新尺寸,避免延迟
|
|
2280
|
+
for (const entry of entries) {
|
|
2281
|
+
// 立即响应尺寸变化,避免过渡期间露出底色
|
|
2282
|
+
handleContainerResize();
|
|
2283
|
+
}
|
|
2267
2284
|
});
|
|
2268
2285
|
resizeObserver.observe(containerRef.value);
|
|
2269
2286
|
} else {
|
|
@@ -2373,6 +2390,8 @@ defineExpose({
|
|
|
2373
2390
|
margin: 0;
|
|
2374
2391
|
padding: 0;
|
|
2375
2392
|
line-height: 0;
|
|
2393
|
+
// 添加平滑过渡,避免切换时露出底色
|
|
2394
|
+
transition: transform 0.3s ease;
|
|
2376
2395
|
|
|
2377
2396
|
img {
|
|
2378
2397
|
display: block; // 移除图片底部默认间隙
|