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
|
@@ -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
|
|
389
|
-
|
|
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');
|