Skip to content

Commit

Permalink
Release 1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
szimek committed Sep 7, 2015
1 parent badaafa commit 0ba3cb4
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ signaturePad.isEmpty();

// Unbinds all event handlers
signaturePad.off();

// Rebinds all event handlers
signaturePad.on();
```

### Options
Expand Down Expand Up @@ -111,6 +114,9 @@ file_put_contents( "signature.png",$decoded_image);
```

## Changelog
### 1.5.0
* Add `on` method that rebinds all event handlers. [Alplob](https://github.com/Alplob)

### 1.4.0
* Add `off` method that unbinds all event handlers. [Rob-ot](https://github.com/Rob-ot)

Expand Down
5 changes: 1 addition & 4 deletions example/js/signature_pad.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}(this, function () {

/*!
* Signature Pad v1.4.0
* Signature Pad v1.5.0
* https://github.com/szimek/signature_pad
*
* Copyright 2015 Szymon Nowak
Expand Down Expand Up @@ -165,7 +165,6 @@ var SignaturePad = (function (document) {
};

SignaturePad.prototype._handleMouseEvents = function () {
var self = this;
this._mouseButtonDown = false;

this._canvas.addEventListener("mousedown", this._handleMouseDown);
Expand All @@ -174,8 +173,6 @@ var SignaturePad = (function (document) {
};

SignaturePad.prototype._handleTouchEvents = function () {
var self = this;

// Pass touch events to canvas element on mobile IE.
this._canvas.style.msTouchAction = 'none';

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "signature_pad",
"description": "Library for drawing smooth signatures.",
"version": "1.4.0",
"version": "1.5.0",
"homepage": "https://github.com/szimek/signature_pad",
"author": {
"name": "Szymon Nowak",
Expand Down
10 changes: 6 additions & 4 deletions signature_pad.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}(this, function () {

/*!
* Signature Pad v1.4.0
* Signature Pad v1.5.0
* https://github.com/szimek/signature_pad
*
* Copyright 2015 Szymon Nowak
Expand Down Expand Up @@ -165,7 +165,6 @@ var SignaturePad = (function (document) {
};

SignaturePad.prototype._handleMouseEvents = function () {
var self = this;
this._mouseButtonDown = false;

this._canvas.addEventListener("mousedown", this._handleMouseDown);
Expand All @@ -174,8 +173,6 @@ var SignaturePad = (function (document) {
};

SignaturePad.prototype._handleTouchEvents = function () {
var self = this;

// Pass touch events to canvas element on mobile IE.
this._canvas.style.msTouchAction = 'none';

Expand All @@ -184,6 +181,11 @@ var SignaturePad = (function (document) {
document.addEventListener("touchend", this._handleTouchEnd);
};

SignaturePad.prototype.on = function () {
this._handleMouseEvents();
this._handleTouchEvents();
};

SignaturePad.prototype.off = function () {
this._canvas.removeEventListener("mousedown", this._handleMouseDown);
this._canvas.removeEventListener("mousemove", this._handleMouseMove);
Expand Down
4 changes: 2 additions & 2 deletions signature_pad.min.js

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

8 changes: 5 additions & 3 deletions src/signature_pad.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ var SignaturePad = (function (document) {
};

SignaturePad.prototype._handleMouseEvents = function () {
var self = this;
this._mouseButtonDown = false;

this._canvas.addEventListener("mousedown", this._handleMouseDown);
Expand All @@ -141,8 +140,6 @@ var SignaturePad = (function (document) {
};

SignaturePad.prototype._handleTouchEvents = function () {
var self = this;

// Pass touch events to canvas element on mobile IE.
this._canvas.style.msTouchAction = 'none';

Expand All @@ -151,6 +148,11 @@ var SignaturePad = (function (document) {
document.addEventListener("touchend", this._handleTouchEnd);
};

SignaturePad.prototype.on = function () {
this._handleMouseEvents();
this._handleTouchEvents();
};

SignaturePad.prototype.off = function () {
this._canvas.removeEventListener("mousedown", this._handleMouseDown);
this._canvas.removeEventListener("mousemove", this._handleMouseMove);
Expand Down

0 comments on commit 0ba3cb4

Please sign in to comment.