Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Add class to <canvas> #84

Open
noamyg opened this issue Oct 7, 2019 · 2 comments
Open

Add class to <canvas> #84

noamyg opened this issue Oct 7, 2019 · 2 comments

Comments

@noamyg
Copy link

noamyg commented Oct 7, 2019

Hi,
In this example of drawing over image, the <canvas> tag gets a custom class.
Is it possible to add it to the nested <canvas> of <signature-pad>?

Thank you

@wulfsolter
Copy link
Owner

Between

@Component({
template: '<canvas></canvas>',
selector: 'signature-pad',
})
and
public ngAfterContentInit(): void {
let sp: any = require('signature_pad')['default'];
let canvas: any = this.elementRef.nativeElement.querySelector('canvas');
if ((<any>this.options)['canvasHeight']) {
canvas.height = (<any>this.options)['canvasHeight'];
}
if ((<any>this.options)['canvasWidth']) {
canvas.width = (<any>this.options)['canvasWidth'];
}
this.signaturePad = new sp(canvas, this.options);
this.signaturePad.onBegin = this.onBegin.bind(this);
this.signaturePad.onEnd = this.onEnd.bind(this);
}

it looks like it would be quite straightforward. However given that I don't use this repo anymore I'm more inclined to review/merge a PR :)

@Srinivasan95-RB
Copy link

Hi, is this done? This will be a very useful feature indeed.

almothafar added a commit to almothafar/angular-signature-pad that referenced this issue Jan 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants