diff --git a/src/Tools/index.js b/src/Tools/index.js index 3544176..77f2a5a 100644 --- a/src/Tools/index.js +++ b/src/Tools/index.js @@ -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