hello all, am drawing on image which is on signature-pad …1st when i perform undo() operation to clear the content of signature-pad …undo operation work properly …but when am display image to signature-pad and then performing undo() operation then it clear entire image…and i dont want to clear or undo …image …i just want to undo drawing points on image
my take photo function code
this.camera.getPicture(options).then((imagePath) => {
if (this.platform.is(‘android’) && sourceType === this.camera.PictureSourceType.PHOTOLIBRARY) {
this.filePath.resolveNativePath(imagePath)
.then(filePath => {
this.lastImage = this.createFileName();
this.tempPath = “data:image/jpeg;base64,” + imagePath;
this.selectedImagePath = imagePath;
//this.signaturePad.fromDataURL(this.tempPath);
//this.tempPath = this.signaturePad.toDataURL(this.tempPath);
});
} else {
this.lastImage = this.createFileName();
this.tempPath = "data:image/jpeg;base64," + imagePath;
this.selectedImagePath = imagePath;
this.signaturePad.fromDataURL(this.tempPath);
// this.selectedImagePath
this.tempPath = this.signaturePad.toDataURL(this.tempPath);
// let canvas = document.querySelector('canvas');
// this.signaturePad.set('canvasWidth', canvas.this.tempath);
// this.signaturePad.set('canvasHeight', canvas.this.tempath);
// let tempPathheight =500;
// this.signaturePad.set('temPath', tempPathheight);
//this.tempPath.Height = CanvasHeight;
}
}, (err) => {
// this.presentToast(err);
console.log(err);
});
}
private createFileName() {
var d = new Date(),
n = d.getTime(),
newFileName = n + “.jpg”;
return newFileName;
}
my undo function
perform()
{
var data = this.signaturePad.toData();
if (data) {
data.pop(); // remove the last dot or line
this.signaturePad.fromData(data);
}
}
please correct my code or tell me where am wrong