Skip to content

Commit

Permalink
Release 1.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
szimek committed Feb 20, 2016
1 parent 7021319 commit 198ee2b
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## Changelog
### 1.5.3
* Fix `touchend` event on touch devices. (#150) [mtomic](https://github.com/mtomic)
* Fix handling touch events in Egde browser. (#134) [dideldum73](https://github.com/dideldum73)

### 1.5.2
* Prevent loading an empty string in `fromDataURL`. (#108) [Remo](https://github.com/Remo)
* Reject points generated by resting hand (better handling of multi touch). (#48 and #57) [jurreantonisse](https://github.com/jurreantonisse)
Expand Down
44 changes: 41 additions & 3 deletions example/js/signature_pad.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module unless amdModuleId is set
define([], function () {
return (root['SignaturePad'] = factory());
});
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory();
} else {
root['SignaturePad'] = factory();
}
}(this, function () {

/*!
* Signature Pad v1.5.3
* https://github.com/szimek/signature_pad
*
* Copyright 2016 Szymon Nowak
* Released under the MIT license
*
* The main idea and some parts of the code (e.g. drawing variable width Bézier curve) are taken from:
* http://corner.squareup.com/2012/07/smoother-signatures.html
*
* Implementation of interpolation using cubic Bézier curves is taken from:
* http://benknowscode.wordpress.com/2012/09/14/path-interpolation-using-cubic-bezier-and-control-point-estimation-in-javascript
*
* Algorithm for approximated length of a Bézier curve is taken from:
* http://www.lemoda.net/maths/bezier-length/index.html
*
*/
var SignaturePad = (function (document) {
"use strict";

Expand Down Expand Up @@ -143,12 +176,13 @@ var SignaturePad = (function (document) {
};

SignaturePad.prototype._handleTouchEvents = function () {
// Pass touch events to canvas element on mobile IE.
// Pass touch events to canvas element on mobile IE11 and Edge.
this._canvas.style.msTouchAction = 'none';
this._canvas.style.touchAction = 'none';

this._canvas.addEventListener("touchstart", this._handleTouchStart);
this._canvas.addEventListener("touchmove", this._handleTouchMove);
document.addEventListener("touchend", this._handleTouchEnd);
this._canvas.addEventListener("touchend", this._handleTouchEnd);
};

SignaturePad.prototype.on = function () {
Expand All @@ -163,7 +197,7 @@ var SignaturePad = (function (document) {

this._canvas.removeEventListener("touchstart", this._handleTouchStart);
this._canvas.removeEventListener("touchmove", this._handleTouchMove);
document.removeEventListener("touchend", this._handleTouchEnd);
this._canvas.removeEventListener("touchend", this._handleTouchEnd);
};

SignaturePad.prototype.isEmpty = function () {
Expand Down Expand Up @@ -349,3 +383,7 @@ var SignaturePad = (function (document) {

return SignaturePad;
})(document);

return SignaturePad;

}));
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
"name": "signature_pad",
"description": "Library for drawing smooth signatures.",
"version": "1.5.2",
"version": "1.5.3",
"homepage": "https://github.com/szimek/signature_pad",
"author": {
"name": "Szymon Nowak",
"email": "szimek@gmail.com",
"url": "https://github.com/szimek"
},
"main": "./signature_pad.js",

"scripts": {
"build": "grunt"
},
"repository" : {
"type" : "git",
"url" : "https://github.com/szimek/signature_pad.git"
Expand Down
11 changes: 6 additions & 5 deletions signature_pad.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
}(this, function () {

/*!
* Signature Pad v1.5.2
* Signature Pad v1.5.3
* https://github.com/szimek/signature_pad
*
* Copyright 2015 Szymon Nowak
* Copyright 2016 Szymon Nowak
* Released under the MIT license
*
* The main idea and some parts of the code (e.g. drawing variable width Bézier curve) are taken from:
Expand Down Expand Up @@ -176,12 +176,13 @@ var SignaturePad = (function (document) {
};

SignaturePad.prototype._handleTouchEvents = function () {
// Pass touch events to canvas element on mobile IE.
// Pass touch events to canvas element on mobile IE11 and Edge.
this._canvas.style.msTouchAction = 'none';
this._canvas.style.touchAction = 'none';

this._canvas.addEventListener("touchstart", this._handleTouchStart);
this._canvas.addEventListener("touchmove", this._handleTouchMove);
document.addEventListener("touchend", this._handleTouchEnd);
this._canvas.addEventListener("touchend", this._handleTouchEnd);
};

SignaturePad.prototype.on = function () {
Expand All @@ -196,7 +197,7 @@ var SignaturePad = (function (document) {

this._canvas.removeEventListener("touchstart", this._handleTouchStart);
this._canvas.removeEventListener("touchmove", this._handleTouchMove);
document.removeEventListener("touchend", this._handleTouchEnd);
this._canvas.removeEventListener("touchend", this._handleTouchEnd);
};

SignaturePad.prototype.isEmpty = function () {
Expand Down
6 changes: 3 additions & 3 deletions signature_pad.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 198ee2b

Please sign in to comment.