修改间距大值 缓冲区bug

This commit is contained in:
2025-07-09 11:26:33 +08:00
parent dd003aa00d
commit 45f2d6f4eb
8 changed files with 54 additions and 36 deletions

View File

@ -555,6 +555,7 @@ class Tools {
// dashSize: newParam.dashSize,
space: newParam.space
})
console.log(newParam.space)
break
case 6: //流动虚线2
material = new Cesium.FlowDashedLineFlowMaterialProperty({
@ -595,19 +596,20 @@ class Tools {
// myImg.src = that.getSourceRootPath() + '/img/arrow/1.png'
myImg.src = options.image
myImg.onload = function () {
options.space = Math.max(0.1, options.space);
if (options.speed > 0 || options.speed == 0) {
canvasEle.width = myImg.width * (options.space + 1)
canvasEle.height = myImg.height
ctx.drawImage(myImg, myImg.width * (options.space / 2), 0)
} else {
ctx.clearRect(0, 0, canvasEle.width, canvasEle.height);
ctx.save(); // 保存当前状态
canvasEle.width = myImg.width * (options.space + 1)
canvasEle.height = myImg.height
ctx.save(); // 保存当前状态
ctx.translate(canvasEle.width / 2, canvasEle.height / 2); // 移动原点至中心
ctx.rotate(Math.PI); // (弧度制)
ctx.translate(-canvasEle.width / 2, -canvasEle.height / 2); // 移回原点
ctx.drawImage(myImg, -myImg.width * (options.space / 2), 0)
ctx.drawImage(myImg, myImg.width * (options.space / 2), 0)
ctx.restore(); // 恢复状态
}