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

Thu Feb 6 14:57:00 CST 2025 inscode

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