diff --git a/src/wScratchPad.js b/src/wScratchPad.js index 649de29..3bba4be 100644 --- a/src/wScratchPad.js +++ b/src/wScratchPad.js @@ -34,7 +34,7 @@ // Make sure we sett style width height here for elastic stretch // and better support for mobile if we are resizing the scratch pad. this.$scratchpad = $(this.canvas).css({position: 'absolute', width: '100%', height: '100%'}); - + this.$scratchpad.bindMobileEvents(); // Setup event handlers. @@ -48,7 +48,7 @@ } this.canvasOffset = $(this.canvas).offset(); - + this.scratch = true; this._scratchFunc(e, 'Down'); }, this)) @@ -172,9 +172,9 @@ _scratchFunc: function (e, event) { e.pageX = Math.floor(e.pageX - this.canvasOffset.left); e.pageY = Math.floor(e.pageY - this.canvasOffset.top); - + this['_scratch' + event](e); - + if (this.options.realtime || event === 'Up') { if (this.options['scratch' + event]) { this.options['scratch' + event].apply(this, [e, this._scratchPercent()]); @@ -185,39 +185,44 @@ _scratchPercent: function() { var hits = 0, imageData = this.ctx.getImageData(0,0, this.canvas.width, this.canvas.height); - + for (var i=0, ii=imageData.data.length; i