rombdn / img-touch-canvas

Add touch gestures (pinch zoom) to images based on Canvas (vanilla HTML5 / JS)
MIT License
148 stars 110 forks source link

没有任何操作,函数也会一直运行 #15

Open yuweilan opened 7 years ago

yuweilan commented 7 years ago

我在下面打了个console,就一直在运行 console.info(this,888);

ImgTouchCanvas.prototype = { animate: function() { //set scale such as image cover all the canvas if(!this.init) { if(this.imgTexture.width) { var scaleRatio = null; if(this.canvas.clientWidth > this.canvas.clientHeight) { scaleRatio = this.canvas.clientWidth / this.imgTexture.width; } else { scaleRatio = this.canvas.clientHeight / this.imgTexture.height; }

                this.scale.x = scaleRatio;
                this.scale.y = scaleRatio;
                this.init = true;
            }
        }

        this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
        console.info(this,888);