@file-viewer/renderer-ofd 2.1.25 → 2.1.26

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": "@file-viewer/renderer-ofd",
3
- "version": "2.1.25",
3
+ "version": "2.1.26",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Standalone OFD renderer plugin for Flyfish File Viewer powered by DLTech21/ofd.js.",
@@ -53,7 +53,7 @@
53
53
  "LICENSE"
54
54
  ],
55
55
  "dependencies": {
56
- "@file-viewer/core": "2.1.25",
56
+ "@file-viewer/core": "2.1.26",
57
57
  "jszip": "^3.10.1"
58
58
  },
59
59
  "devDependencies": {
@@ -60,7 +60,7 @@ export const renderOfd = function (screenWidth, ofd) {
60
60
  const pageId = Object.keys(page)[0];
61
61
  let pageDiv = document.createElement('div');
62
62
  pageDiv.id = pageId;
63
- pageDiv.setAttribute('style', `margin-bottom: 20px;position: relative;width:${box.w}px;height:${box.h}px;background: white;`)
63
+ pageDiv.setAttribute('style', `margin-bottom: 20px;position: relative;width:${box.w}px;height:${box.h}px;background: white;overflow:hidden;`)
64
64
  renderPage(pageDiv, page, ofd.tpls, ofd.fontResObj, ofd.drawParamResObj, ofd.multiMediaResObj);
65
65
  divArray.push(pageDiv);
66
66
  }
@@ -77,7 +77,7 @@ export const renderOfdByScale = function (ofd) {
77
77
  const pageId = Object.keys(page)[0];
78
78
  let pageDiv = document.createElement('div');
79
79
  pageDiv.id = pageId;
80
- pageDiv.setAttribute('style', `margin-bottom: 20px;position: relative;width:${box.w}px;height:${box.h}px;background: white;`)
80
+ pageDiv.setAttribute('style', `margin-bottom: 20px;position: relative;width:${box.w}px;height:${box.h}px;background: white;overflow:hidden;`)
81
81
  renderPage(pageDiv, page, ofd.tpls, ofd.fontResObj, ofd.drawParamResObj, ofd.multiMediaResObj);
82
82
  divArray.push(pageDiv);
83
83
  }
@@ -418,16 +418,15 @@ export const renderImageOnDiv = function (pageWidth, pageHeight, imgSrc, boundar
418
418
  img.setAttribute('width', '100%');
419
419
  img.setAttribute('height', '100%');
420
420
  div.appendChild(img);
421
- const pw = parseFloat(pageWidth.replace('px', ''));
422
- const ph = parseFloat(pageHeight.replace('px', ''));
423
- const w = boundary.w > pw ? pw : boundary.w;
424
- const h = boundary.h > ph ? ph : boundary.h;
425
421
  let c = '';
426
422
  if (clip) {
427
423
  clip = converterBox(clip);
428
424
  c = `clip: rect(${clip.y}px, ${clip.w + clip.x}px, ${clip.h + clip.y}px, ${clip.x}px)`
429
425
  }
430
- div.setAttribute('style', `cursor: pointer; overflow: hidden; position: absolute; left: ${c ? boundary.x : boundary.x < 0 ? 0 : boundary.x}px; top: ${c ? boundary.y : boundary.y < 0 ? 0 : boundary.y}px; width: ${w}px; height: ${h}px; ${c};z-index: ${oid}`)
426
+ // Preserve the stamp geometry declared by OFD. Oversized or partially
427
+ // off-page seals are clipped by the page container, matching OFD readers;
428
+ // shrinking or moving the seal here changes both its position and scale.
429
+ div.setAttribute('style', `cursor: pointer; overflow: hidden; position: absolute; left: ${boundary.x}px; top: ${boundary.y}px; width: ${boundary.w}px; height: ${boundary.h}px; ${c};z-index: ${oid}`)
431
430
  return div;
432
431
  }
433
432