john_hancock 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascript/john_hancock.js +18 -18
- data/app/assets/javascript/signature_pad.js +8 -2
- data/lib/john_hancock/rails/engine.rb +0 -1
- data/lib/john_hancock/version.rb +1 -1
- metadata +2 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6b2efb8eec6688d0a899f3d59cf96dd427440e7
|
4
|
+
data.tar.gz: ce62088e18addcb0e011fcaed97d63f8671422c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac0d36706deb77b63d8920a1ecb192aeee9faba63354e2be7c20d972c82aa930249b6cb489c8fe06372b5b2971534b817f79f284a94aa54d6cc5bc033b58e196
|
7
|
+
data.tar.gz: 2e55078a49f2151a6e54b9c081173323c3fb59aea0f1972dd6741880ae1d130aade5f8b0b8303a5d6dddb86b0ae4c8abcf39a0c68145eafa0afa82d2e9a0fd22
|
@@ -1,26 +1,26 @@
|
|
1
1
|
//= require signature_pad
|
2
|
-
$( document ).ready(function() {
|
3
|
-
if(document.getElementById("JohnHancock-canvas")){
|
4
|
-
var canvas = document.getElementById("JohnHancock-canvas"),
|
5
|
-
hidden_field = document.getElementById("JohnHancock-hidden"),
|
6
|
-
parent_form = $(canvas).closest("form"),
|
7
|
-
signaturePad;
|
8
2
|
|
9
|
-
|
3
|
+
document.addEventListener('DOMContentLoaded', function(){
|
4
|
+
const canvas = document.getElementById("JohnHancock-canvas");
|
5
|
+
const hidden_field = document.getElementById("JohnHancock-hidden");
|
10
6
|
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
if (canvas && hidden_field) {
|
8
|
+
const parent_form = canvas.closest("form");
|
9
|
+
const signaturePad = new SignaturePad(canvas);
|
10
|
+
|
11
|
+
parent_form.onsubmit = function() {
|
12
|
+
hidden_field.value = signaturePad.toDataURL()
|
13
|
+
}
|
14
14
|
|
15
15
|
function resizeCanvas() {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
}
|
16
|
+
var ratio = Math.max(window.devicePixelRatio || 1, 1);
|
17
|
+
canvas.width = canvas.offsetWidth * ratio;
|
18
|
+
canvas.height = canvas.offsetHeight * ratio;
|
19
|
+
canvas.getContext("2d").scale(ratio, ratio);
|
20
|
+
signaturePad.clear();
|
21
|
+
}
|
22
22
|
|
23
|
-
window.addEventListener("resize", resizeCanvas);
|
23
|
+
window.addEventListener("resize", resizeCanvas, true);
|
24
24
|
resizeCanvas();
|
25
25
|
}
|
26
|
-
})
|
26
|
+
}, false)
|
@@ -1,3 +1,9 @@
|
|
1
|
+
var passiveIfSupported = false;
|
2
|
+
|
3
|
+
try {
|
4
|
+
window.addEventListener("test", null, Object.defineProperty({}, "passive", { get: function() { passiveIfSupported = { passive: true }; } }));
|
5
|
+
} catch(err) {}
|
6
|
+
|
1
7
|
function Point(x, y, time) {
|
2
8
|
this.x = x;
|
3
9
|
this.y = y;
|
@@ -242,8 +248,8 @@ SignaturePad.prototype._handleTouchEvents = function () {
|
|
242
248
|
this._canvas.style.msTouchAction = 'none';
|
243
249
|
this._canvas.style.touchAction = 'none';
|
244
250
|
|
245
|
-
this._canvas.addEventListener('touchstart', this._handleTouchStart);
|
246
|
-
this._canvas.addEventListener('touchmove', this._handleTouchMove);
|
251
|
+
this._canvas.addEventListener('touchstart', this._handleTouchStart, passiveIfSupported);
|
252
|
+
this._canvas.addEventListener('touchmove', this._handleTouchMove, passiveIfSupported);
|
247
253
|
this._canvas.addEventListener('touchend', this._handleTouchEnd);
|
248
254
|
};
|
249
255
|
|
data/lib/john_hancock/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: john_hancock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Lawrence
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-10-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sqlite3
|
@@ -39,20 +39,6 @@ dependencies:
|
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: jquery-rails
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
56
42
|
- !ruby/object:Gem::Dependency
|
57
43
|
name: test-unit
|
58
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,20 +67,6 @@ dependencies:
|
|
81
67
|
- - ">="
|
82
68
|
- !ruby/object:Gem::Version
|
83
69
|
version: '0'
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: poltergeist
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: '0'
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - ">="
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '0'
|
98
70
|
- !ruby/object:Gem::Dependency
|
99
71
|
name: launchy
|
100
72
|
requirement: !ruby/object:Gem::Requirement
|