Skip to content

Commit efbd049

Browse files
committed
Update readme
1 parent 64939d7 commit efbd049

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ API is identical to [szimek/signature_pad](https://www.npmjs.com/package/signatu
1616
Options are as per [szimek/signature_pad](https://www.npmjs.com/package/signature_pad) with the following additions:
1717
* canvasWidth: width of the canvas (px)
1818
* canvasHeight: height of the canvas (px)
19-
The above options are provided to avoid accessing the DOM directly from your component to adjust the canvas size.
19+
The above options are provided to avoid accessing the DOM directly from your component to adjust the canvas size.
2020

2121
```typescript
2222

@@ -36,20 +36,21 @@ import { SignaturePadModule } from '@almothafar/angular-signature-pad';
3636
// then import for use in a component
3737

3838
import { Component, ViewChild } from '@angular/core';
39-
import { SignaturePad } from '@almothafar/angular-signature-pad';
39+
import { SignaturePadComponent } from '@almothafar/angular-signature-pad';
4040

4141
@Component({
42-
template: '<signature-pad [options]="signaturePadOptions" (onBeginEvent)="drawStart()" (onEndEvent)="drawComplete()"></signature-pad>'
42+
template: '<signature-pad #signature [options]="signaturePadOptions" (drawStart)="drawStart($event)" (drawEnd)="drawComplete($event)"></signature-pad>'
4343
})
4444

4545
export class SignaturePadPage {
4646

47-
@ViewChild(SignaturePad) signaturePad: SignaturePad;
47+
@ViewChild('signature')
48+
public signaturePad: SignaturePadComponent;
4849

49-
private signaturePadOptions: Object = { // passed through to szimek/signature_pad constructor
50-
'minWidth': 5,
51-
'canvasWidth': 500,
52-
'canvasHeight': 300
50+
private signaturePadOptions: NgSignaturePadOptions = { // passed through to szimek/signature_pad constructor
51+
minWidth: 5,
52+
canvasWidth: 500,
53+
canvasHeight: 300
5354
};
5455

5556
constructor() {
@@ -62,14 +63,15 @@ export class SignaturePadPage {
6263
this.signaturePad.clear(); // invoke functions from szimek/signature_pad API
6364
}
6465

65-
drawComplete() {
66+
drawComplete(event: MouseEvent | Touch) {
6667
// will be notified of szimek/signature_pad's onEnd event
68+
console.log('Completed drawing', event);
6769
console.log(this.signaturePad.toDataURL());
6870
}
6971

70-
drawStart() {
72+
drawStart(event: MouseEvent | Touch) {
7173
// will be notified of szimek/signature_pad's onBegin event
72-
console.log('begin drawing');
74+
console.log('Start drawing', event);
7375
}
7476
}
7577
```

projects/angular-signature-pad/README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,21 @@ import { SignaturePadModule } from '@almothafar/angular-signature-pad';
3636
// then import for use in a component
3737

3838
import { Component, ViewChild } from '@angular/core';
39-
import { SignaturePad } from '@almothafar/angular-signature-pad';
39+
import { SignaturePadComponent } from '@almothafar/angular-signature-pad';
4040

4141
@Component({
42-
template: '<signature-pad [options]="signaturePadOptions" (onBeginEvent)="drawStart()" (onEndEvent)="drawComplete()"></signature-pad>'
42+
template: '<signature-pad #signature [options]="signaturePadOptions" (drawStart)="drawStart($event)" (drawEnd)="drawComplete($event)"></signature-pad>'
4343
})
4444

4545
export class SignaturePadPage {
4646

47-
@ViewChild(SignaturePad) signaturePad: SignaturePad;
47+
@ViewChild('signature')
48+
public signaturePad: SignaturePadComponent;
4849

49-
private signaturePadOptions: Object = { // passed through to szimek/signature_pad constructor
50-
'minWidth': 5,
51-
'canvasWidth': 500,
52-
'canvasHeight': 300
50+
private signaturePadOptions: NgSignaturePadOptions = { // passed through to szimek/signature_pad constructor
51+
minWidth: 5,
52+
canvasWidth: 500,
53+
canvasHeight: 300
5354
};
5455

5556
constructor() {
@@ -62,14 +63,15 @@ export class SignaturePadPage {
6263
this.signaturePad.clear(); // invoke functions from szimek/signature_pad API
6364
}
6465

65-
drawComplete() {
66+
drawComplete(event: MouseEvent | Touch) {
6667
// will be notified of szimek/signature_pad's onEnd event
68+
console.log('Completed drawing', event);
6769
console.log(this.signaturePad.toDataURL());
6870
}
6971

70-
drawStart() {
72+
drawStart(event: MouseEvent | Touch) {
7173
// will be notified of szimek/signature_pad's onBegin event
72-
console.log('begin drawing');
74+
console.log('Start drawing', event);
7375
}
7476
}
7577
```

0 commit comments

Comments
 (0)