提交 3f22fcd0 编写于 作者: Q qq_41923622

Thu Feb 6 14:57:00 CST 2025 inscode

上级 7fe21fe5
......@@ -68,7 +68,12 @@ function annotationsInit(imgData,canvas,historyRef){
});
break;
case 'arrow' :
newObject = new ArrowClass(annotation.pointList||[annotation.left,annotation.top,annotation.left,annotation.top], {
let pointList = annotation.pointList||[annotation.left,annotation.top,annotation.left,annotation.top]
pointList[0] = pointList[0]*scaleX;
pointList[1] = pointList[1]*scaleY;
pointList[2] = pointList[2]*scaleX;
pointList[3] = pointList[3]*scaleY;
newObject = new ArrowClass(pointList, {
strokeWidth: annotation.size* Math.max(scaleX, scaleY),
stroke: annotation.stroke,
id: new Date().valueOf() + '_' + Math.random() * 4,
......@@ -76,14 +81,18 @@ function annotationsInit(imgData,canvas,historyRef){
newObject.strokeUniform = true;
break;
case 'path' :
const adjustedPath = annotation.path.map((segment) => {
if (typeof segment[1] === 'number') {
segment[1] *= scaleX;
const adjustedPath = annotation.path.map((segment) => {
const newSegment = [...segment];
for (let i = 1; i < newSegment.length; i++) {
if (typeof newSegment[i] === 'number') {
if (i % 2 === 1) {
newSegment[i] *= scaleX;
} else {
newSegment[i] *= scaleY;
}
}
}
if (typeof segment[2] === 'number') {
segment[2] *= scaleY;
}
return segment;
return newSegment;
});
newObject = new fabric.Path(adjustedPath, {
fill: annotation.fill,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册