@koi-br/ocr-web-sdk 1.0.44 → 1.0.46

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koi-br/ocr-web-sdk",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
4
4
  "description": "一个支持多种Office文件格式预览的Vue3组件SDK,包括PDF、Word、Excel、图片、OFD、TIF等格式",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -360,6 +360,11 @@ const props = defineProps({
360
360
  type: Boolean,
361
361
  default: true, // 默认不显示,保持向后兼容(isDownload 的默认值)
362
362
  },
363
+ // 是否启用文本块的 hover 效果(高亮和显示批注按钮)
364
+ enableBlockHover: {
365
+ type: Boolean,
366
+ default: true,
367
+ },
363
368
  });
364
369
 
365
370
  const emit = defineEmits<{
@@ -1277,6 +1282,11 @@ const renderTextLayer = (pageNum?: number) => {
1277
1282
 
1278
1283
  // Hover 和点击事件
1279
1284
  blockDiv.addEventListener("mouseenter", (e) => {
1285
+ // 如果禁用了 hover 效果,不执行相关逻辑
1286
+ if (!props.enableBlockHover) {
1287
+ return;
1288
+ }
1289
+
1280
1290
  // 取消之前的隐藏定时器
1281
1291
  if (hideTimer) {
1282
1292
  clearTimeout(hideTimer);
@@ -1322,6 +1332,10 @@ const renderTextLayer = (pageNum?: number) => {
1322
1332
  });
1323
1333
 
1324
1334
  blockDiv.addEventListener("mouseleave", () => {
1335
+ // 如果禁用了 hover 效果,不执行隐藏逻辑
1336
+ if (!props.enableBlockHover) {
1337
+ return;
1338
+ }
1325
1339
  // 延迟隐藏,给用户时间移动到批注按钮
1326
1340
  hideAnnotationButton();
1327
1341
  });
@@ -2431,10 +2445,8 @@ const handleContainerResize = () => {
2431
2445
  resizeTimer = null;
2432
2446
  }
2433
2447
 
2434
- // 隐藏图片,显示 loading
2448
+ // 宽度变化时不显示 loading,只更新缩放比例(避免看起来像重新加载)
2435
2449
  console.log('[ImagePreview] handleContainerResize: 开始重新计算');
2436
- isImageReady.value = false;
2437
- isCalculatingAutoFit.value = true;
2438
2450
 
2439
2451
  // 立即计算并应用新的缩放比例,避免过渡期间露出底色
2440
2452
  // 使用 requestAnimationFrame 确保在浏览器重绘前更新
@@ -2464,13 +2476,9 @@ const handleContainerResize = () => {
2464
2476
  } catch (error) {
2465
2477
  console.error('[ImagePreview] handleContainerResize: 最终计算失败:', error);
2466
2478
  } finally {
2467
- // 计算完成后,显示图片并隐藏 loading
2479
+ // 计算完成,重置标记(不改变图片显示状态,因为宽度变化时不应该显示loading
2468
2480
  console.log('[ImagePreview] handleContainerResize: 更新状态完成');
2469
- isCalculatingAutoFit.value = false;
2470
2481
  isResizing = false; // 重置标记
2471
- requestAnimationFrame(() => {
2472
- isImageReady.value = true;
2473
- });
2474
2482
  }
2475
2483
  }, 350); // 350ms 延迟,略大于过渡动画时间(300ms),确保过渡完成后稳定
2476
2484
  });