Skip to content

Commit ee08bac

Browse files
Merge pull request #3 from FieldControl/k
feat: 🎸 kkk
2 parents 023abc1 + cb4a976 commit ee08bac

22 files changed

+656
-3
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# See http://help.github.com/ignore-files/ for more about ignoring files.
22

33
# compiled output
4-
/dist
54
/tmp
65
/out-tsc
76
# Only exists if Bazel was run

dist/angular2-signaturepad/README.md

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# angular2-signaturepad
2+
Angular 2 component for [szimek/signature_pad](https://www.npmjs.com/package/signature_pad).
3+
4+
<< THIS IS NO LONGER IN USE BY OWNER. PROBLEMS CAN AND DO EXIST. PRs ARE SUPER WELCOME, BUT I CAN NOT IDENTIFY WHAT YOUR ISSUES ARE, NOR WILL I CHANGE THINGS BECAUSE ANGULAR HAS CHANGED IN THE YEARS SINCE I WROTE THIS >>
5+
6+
## Install
7+
`npm install angular2-signaturepad --save`
8+
9+
## Reference Implementation
10+
11+
* [Live Demo](http://lathonez.com/angular2-signaturepad-demo/)
12+
* [Source](https://github.com/lathonez/angular2-signaturepad-demo)
13+
14+
## Usage example
15+
16+
API is identical to [szimek/signature_pad](https://www.npmjs.com/package/signature_pad).
17+
18+
Options are as per [szimek/signature_pad](https://www.npmjs.com/package/signature_pad) with the following additions:
19+
* canvasWidth: width of the canvas (px)
20+
* canvasHeight: height of the canvas (px)
21+
The above options are provided to avoid accessing the DOM directly from your component to adjust the canvas size.
22+
23+
```typescript
24+
25+
// import into app module
26+
27+
import { SignaturePadModule } from 'angular2-signaturepad';
28+
29+
...
30+
31+
@NgModule({
32+
declarations: [ ],
33+
imports: [ SignaturePadModule ],
34+
providers: [ ],
35+
bootstrap: [ AppComponent ]
36+
})
37+
38+
// then import for use in a component
39+
40+
import { Component, ViewChild } from 'angular2/core';
41+
import { SignaturePad } from 'angular2-signaturepad/signature-pad';
42+
43+
@Component({
44+
template: '<signature-pad [options]="signaturePadOptions" (onBeginEvent)="drawStart()" (onEndEvent)="drawComplete()"></signature-pad>'
45+
})
46+
47+
export class SignaturePadPage{
48+
49+
@ViewChild(SignaturePad) signaturePad: SignaturePad;
50+
51+
private signaturePadOptions: Object = { // passed through to szimek/signature_pad constructor
52+
'minWidth': 5,
53+
'canvasWidth': 500,
54+
'canvasHeight': 300
55+
};
56+
57+
constructor() {
58+
// no-op
59+
}
60+
61+
ngAfterViewInit() {
62+
// this.signaturePad is now available
63+
this.signaturePad.set('minWidth', 5); // set szimek/signature_pad options at runtime
64+
this.signaturePad.clear(); // invoke functions from szimek/signature_pad API
65+
}
66+
67+
drawComplete() {
68+
// will be notified of szimek/signature_pad's onEnd event
69+
console.log(this.signaturePad.toDataURL());
70+
}
71+
72+
drawStart() {
73+
// will be notified of szimek/signature_pad's onBegin event
74+
console.log('begin drawing');
75+
}
76+
}
77+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* Generated bundle index. Do not edit.
3+
*/
4+
/// <amd-module name="angular2-signaturepad" />
5+
export * from './public-api';
6+
//# sourceMappingURL=angular2-signaturepad.d.ts.map

dist/angular2-signaturepad/angular2-signaturepad.d.ts.map

+1
Original file line numberDiff line numberDiff line change

dist/angular2-signaturepad/bundles/angular2-signaturepad.umd.js

+174
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular2-signaturepad/bundles/angular2-signaturepad.umd.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)