Is there any options to detect changes on fabricJS? I use following program to save my canvas. Then when save it again, I have to detect whether there are any changes on canvas before going to save it again. How to do this?
var printImg = canvas.toDataURL({
format: 'png',
multiplier: multi,
left: (canvas.width - maskWidth)/2,
height: maskOriHeight/multi,
width: maskOriWidth/multi
});
I'm using following code to compare objects.
var oldJSON = JSON.stringify(canvas.toDatalessJSON(['id']));
var newJSON = JSON.stringify(canvas.toDatalessJSON(['id']));
if(newJSON === oldJSON) {
console.log('Equal');
} else {
console.log('Not Equal');
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With