Comments (4)
https://github.com/wulfsolter/angular2-signaturepad/blob/master/signature-pad.ts#L46-L56
So from your code, you need to call:
this.signaturePad.resizeCanvas();
from angular2-signaturepad.
Hey thanks a lot man I will give that a shot.
from angular2-signaturepad.
I would really appreciate if you could help me out. I added the
this.signaturePad.resizeCanvas();
But it does not seem to resize the canvas. It does appear to be firing the event.
event {isTrusted: true, type: "resize", target: Window, currentTarget: Window, eventPhase: 2…}bubbles: falsecancelBubble: falsecancelable: falsecomposed: falsecurrentTarget: WindowdefaultPrevented: falseeventPhase: 2isTrusted: truepath: Array(1)returnValue: truesrcElement: Windowtarget: WindowtimeStamp: 25201.9type: "resize"proto: Event
Here is my resizeCanvas function
onResize(event) {
console.log("THIS RESIZE EVENT IS FIRING OFF");
this.signaturePad.resizeCanvas();
console.log(event);
}
Inside my view I am adding checking for window resize to fire it off like this,
<div class="card-block">
<div (window:resize)="onResize($event)" class="signature">
<signature-pad [options]="signaturePadOptions" (onBeginEvent)="drawStart()" (onEndEvent)="drawComplete()"></signature-pad>
</div>
</div>
Issues,
Resize
initially it is set to 500. I would like it to be 100 percent of it's parent div. Then if the screen is resized obviously change to the new width.
Completing with the whole signature
When I lift finger up or release click from mouse it completes and finishes. Is it possible to set it to not complete till the user click submit on a form? The problem is if someone is writing their name and they let off then press back down to start again, it sends two different signatures.
Is there something built into handle this or do I need to come up with my own way?
Here is my full code,
export class ContractComponent implements OnInit, AfterViewInit {
@ViewChild(SignaturePad) signaturePad: SignaturePad;
contractForm: FormGroup;
onResize(event) {
console.log("THIS RESIZE EVENT IS FIRING OFF");
this.signaturePad.resizeCanvas();
console.log(event);
}
private signaturePadOptions: Object = { // passed through to szimek/signature_pad constructor
'minWidth': 5,
'canvasWidth': 500,
'canvasHeight': 300
};
constructor(private router: Router, private auth: Auth, private http: Http, private toastyService: ToastyService, private toastyConfig: ToastyConfig) { }
ngAfterViewInit() {
// this.signaturePad is now available
this.signaturePad.set('minWidth', 5); // set szimek/signature_pad options at runtime
this.signaturePad.clear(); // invoke functions from szimek/signature_pad API
}
drawComplete() {
// will be notified of szimek/signature_pad's onEnd event
console.log(this.signaturePad.toDataURL());
}
drawStart() {
// will be notified of szimek/signature_pad's onBegin event
console.log('begin drawing');
}
This is in the view,
<div class="card card-inverse card-success">
<div class="card-header">
<strong>Signature</strong>
</div>
<div class="card-block">
<div (window:resize)="onResize($event)" class="signature">
<signature-pad [options]="signaturePadOptions" (onBeginEvent)="drawStart()" (onEndEvent)="drawComplete()"></signature-pad>
</div>
</div>
<div class="card-footer tag-primary white">
Complete profile subscription -
<button type="submit" (click)="toastSuccess('Form Update', 'You have updated your personal information successfully.')" [disabled]="!contractForm.valid" class="btn btn-sm btn-danger btn-oj"><i class="fa fa-dot-circle-o"></i> Update</button>
</div>
</div>
from angular2-signaturepad.
Added example in demo lathonez/angular2-signaturepad-demo@c6c1320
from angular2-signaturepad.
Related Issues (20)
- [Ionic]: Signature Pad focus issue for iOS devices (issue A11y) HOT 1
- [ERROR] Build with angular/[email protected] HOT 2
- is there a regression of Fix #94 ? HOT 1
- Compilation issue, gives module has no exported member 'SignaturePadModule' HOT 3
- ERROR in src/app/components/modals/modals.module.ts(15,10): error TS2305: Module '"../../../../node_modules/angular2-signaturepad/angular2-signaturepad"' has no exported member 'SignaturePadModule'. HOT 3
- this.sigaturePad.set('canvasWidth', value) giving error HOT 4
- Signature pad issue on iOS 12 Device HOT 1
- Update to Angular 13 HOT 14
- Outdated peer dependency warnings
- Voiceover in IOS completely ignores the signature pad.
- Error: Module not found: Error: Can't resolve 'signature_pad' (v4.0.1 with Angular v13 Error) HOT 3
- Getting correct mouse offset on scale
- Memory Leaks HOT 1
- Ivy/Angular9 Compatibility (Symbol is not exported)
- OnResize window canvas height increase constantly independent of screen size HOT 4
- 'node_modules/angular2-signaturepad/index.ts' not found
- iOS/safari canvas memory leak
- `Cannot read property 'offsetWidth' of undefined` on resizeCanvas HOT 2
- Upgrade to angular 8+ HOT 5
- Signature with Text HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular2-signaturepad.