修改线当速度为0时不反向bug

This commit is contained in:
2025-11-28 17:10:11 +08:00
parent 1fecb7872f
commit 669f2bf908

View File

@ -709,7 +709,8 @@ class Tools {
color: color,
image: this.getSourceRootPath() + `/img/arrow/${type - 6}.png`,
space: newParam.space,
speed: newParam.speed
speed: newParam.speed,
rotate: newParam.rotate
}
param.speed = newParam.rotate ? param.speed : 0 - param.speed
@ -733,11 +734,11 @@ class Tools {
myImg.src = options.image
myImg.onload = function () {
options.space = Math.max(0.1, options.space);
if (options.speed > 0 || options.speed == 0) {
if (options.speed > 0 || (options.speed == 0 && options.rotate)) {
canvasEle.width = myImg.width * (options.space + 1)
canvasEle.height = myImg.height
ctx.drawImage(myImg, myImg.width * (options.space / 2), 0)
} else {
} else if (options.speed < 0 || (options.speed == 0 && !options.rotate)) {
ctx.clearRect(0, 0, canvasEle.width, canvasEle.height);
canvasEle.width = myImg.width * (options.space + 1)
canvasEle.height = myImg.height