修改线当速度为0时不反向bug
This commit is contained in:
@ -709,7 +709,8 @@ class Tools {
|
|||||||
color: color,
|
color: color,
|
||||||
image: this.getSourceRootPath() + `/img/arrow/${type - 6}.png`,
|
image: this.getSourceRootPath() + `/img/arrow/${type - 6}.png`,
|
||||||
space: newParam.space,
|
space: newParam.space,
|
||||||
speed: newParam.speed
|
speed: newParam.speed,
|
||||||
|
rotate: newParam.rotate
|
||||||
}
|
}
|
||||||
|
|
||||||
param.speed = newParam.rotate ? param.speed : 0 - param.speed
|
param.speed = newParam.rotate ? param.speed : 0 - param.speed
|
||||||
@ -733,11 +734,11 @@ class Tools {
|
|||||||
myImg.src = options.image
|
myImg.src = options.image
|
||||||
myImg.onload = function () {
|
myImg.onload = function () {
|
||||||
options.space = Math.max(0.1, options.space);
|
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.width = myImg.width * (options.space + 1)
|
||||||
canvasEle.height = myImg.height
|
canvasEle.height = myImg.height
|
||||||
ctx.drawImage(myImg, myImg.width * (options.space / 2), 0)
|
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);
|
ctx.clearRect(0, 0, canvasEle.width, canvasEle.height);
|
||||||
canvasEle.width = myImg.width * (options.space + 1)
|
canvasEle.width = myImg.width * (options.space + 1)
|
||||||
canvasEle.height = myImg.height
|
canvasEle.height = myImg.height
|
||||||
|
|||||||
Reference in New Issue
Block a user