-
Creator 版本: 3.0-3.2
-
目标平台: macOS,Android,iOS。真机以及模拟器,以及网页浏览器都会出现
-
之前哪个版本是正常的: 2.4.5是正常的
-
编辑器操作系统:macOS 11.4
-
重现概率: 100%
本想画一个这样的

然而画出来是这样的。

我的代码是这样的。
//函数
drawPahtString(g: cc.Graphics,pathString:string,color:string,x: number,y: number,scale: number)
{
pathString=pathString.replace(/,/igm," ");
pathString=pathString.replace(/([a-zA-Z])(\d)/igm,"$1 $2");
pathString=pathString.replace(/[ ]+]/igm," ");
let pArray=pathString.split(" ");
// console.log(pathString,pArray)
for(let i=0;i<pArray.length;i++)
{
let item=pArray[i];
switch(item)
{
case 'M':
{
// if(i!=0) g.close();
g.moveTo(x+Number(pArray[i+1])*scale,y-Number(pArray[i+2])*scale);
console.log("M",x+Number(pArray[i+1])*scale,y-Number(pArray[i+2])*scale)
i+=2;
}
break;
case 'L':
{
g.lineTo(x+Number(pArray[i+1])*scale,y-Number(pArray[i+2])*scale);
console.log("L",x+Number(pArray[i+1])*scale,y-Number(pArray[i+2])*scale)
i+=2;
}
break;
case 'C':
{
g.bezierCurveTo(x+Number(pArray[i+1])*scale,y-Number(pArray[i+2])*scale,x+Number(pArray[i+3])*scale,y-Number(pArray[i+4])*scale,x+Number(pArray[i+5])*scale,y-Number(pArray[i+6])*scale);
console.log("C",x+Number(pArray[i+1])*scale,y-Number(pArray[i+2])*scale,x+Number(pArray[i+3])*scale,y-Number(pArray[i+4])*scale,x+Number(pArray[i+5])*scale,y-Number(pArray[i+6])*scale)
i+=6;
}
break;
case 'Z':
{
g.close();
}
break;
default:
console.log("unknow",item)
break;
}
}
g.fill();
}
//调用
let b1=“M20.1,-7.9 C19.5,-11.8 17.1,-15.5 12,-15.5 C7,-15.5 4.1,-12.4 3.6,-11.8 L4,-43.9 C4,-44.7 3.4,-45.3 2.6,-45.3 L1.4,-45.3 C0.6,-45.3 0,-44.7 0,-43.9 L0.5,16.2 C0.5,17 1.1,17.6 1.9,17.6 C2.1,17.6 2.5,17.5 2.7,17.4 C3.1,17.2 9.6,14 15,7.9 C18.8,3.6 20.3,-1.3 20.3,-5.4 C20.3,-6.3 20.2,-7.1 20.1,-7.9 "
this.drawPahtString(this.graphics,b1,”#000000",100,-100,10);
最后一个参数很神奇,把10改成9,画出来是正常的,大于9的整数就不行了。