kfb-view 3.3.7 → 3.3.8

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,7 +1,7 @@
1
1
  {
2
2
  "name": "kfb-view",
3
3
  "description": "一个在线kfb的阅片软件",
4
- "version": "3.3.7",
4
+ "version": "3.3.8",
5
5
  "author": "qifeng.fan <qifeng.fan@hzztai.com>",
6
6
  "license": "MIT",
7
7
  "main": "lib/kfb-view.cjs.js",
@@ -361,6 +361,9 @@ export class Tailoring extends ViewerCommon {
361
361
  const radioY = canvasHeight / height;
362
362
  const disWidth = Math.abs(endPoint.x - startPoint.x) * radioX;
363
363
  const disHeight = Math.abs(endPoint.y - startPoint.y) * radioY;
364
+ // 与 drawer 不同:标注层 canvas 的 width/height 与视口 CSS 像素一致,不能用 drawer 的 radio 做源矩形
365
+ const shapeSrcW = Math.abs(endPoint.x - startPoint.x);
366
+ const shapeSrcH = Math.abs(endPoint.y - startPoint.y);
364
367
  if (disWidth.toFixed(5) / 1 === 0 || disHeight.toFixed(5) / 1 === 0) {
365
368
  return;
366
369
  }
@@ -385,9 +388,8 @@ export class Tailoring extends ViewerCommon {
385
388
  copyCtx.putImageData(imageData, 0, 0, 0, 0, disWidth, disHeight);
386
389
  const shapeCanvas = this.kv.shape?.canvas;
387
390
  if (shapeCanvas && this.options.shape) {
388
- copyCtx.drawImage(shapeCanvas, startPoint.x * radioX,
389
- startPoint.y * radioY, disWidth, disHeight, 0, 0, disWidth,
390
- disHeight);
391
+ copyCtx.drawImage(shapeCanvas, startPoint.x, startPoint.y, shapeSrcW,
392
+ shapeSrcH, 0, 0, disWidth, disHeight);
391
393
  }
392
394
  if (copyCanvas.width > this.options.resolution) {
393
395
  const maxCanvas = document.createElement('canvas');