kfb-view 3.3.6 → 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
|
@@ -45,9 +45,11 @@ export class Tailoring extends ViewerCommon {
|
|
|
45
45
|
left,
|
|
46
46
|
top,
|
|
47
47
|
color,
|
|
48
|
-
now = false,
|
|
49
48
|
contents = [],
|
|
49
|
+
shape = true,
|
|
50
|
+
now = false,
|
|
50
51
|
}) {
|
|
52
|
+
this.options.shape = shape;
|
|
51
53
|
this.isInTailoring = true;
|
|
52
54
|
this.movePointIndex = -1;
|
|
53
55
|
const pointList = getRectPoint({x: left, y: top},
|
|
@@ -359,6 +361,9 @@ export class Tailoring extends ViewerCommon {
|
|
|
359
361
|
const radioY = canvasHeight / height;
|
|
360
362
|
const disWidth = Math.abs(endPoint.x - startPoint.x) * radioX;
|
|
361
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);
|
|
362
367
|
if (disWidth.toFixed(5) / 1 === 0 || disHeight.toFixed(5) / 1 === 0) {
|
|
363
368
|
return;
|
|
364
369
|
}
|
|
@@ -383,9 +388,8 @@ export class Tailoring extends ViewerCommon {
|
|
|
383
388
|
copyCtx.putImageData(imageData, 0, 0, 0, 0, disWidth, disHeight);
|
|
384
389
|
const shapeCanvas = this.kv.shape?.canvas;
|
|
385
390
|
if (shapeCanvas && this.options.shape) {
|
|
386
|
-
copyCtx.drawImage(shapeCanvas, startPoint.x
|
|
387
|
-
|
|
388
|
-
disHeight);
|
|
391
|
+
copyCtx.drawImage(shapeCanvas, startPoint.x, startPoint.y, shapeSrcW,
|
|
392
|
+
shapeSrcH, 0, 0, disWidth, disHeight);
|
|
389
393
|
}
|
|
390
394
|
if (copyCanvas.width > this.options.resolution) {
|
|
391
395
|
const maxCanvas = document.createElement('canvas');
|