Skip to content

Commit

Permalink
Ensure Canvas Has Changed Before Event Firing
Browse files Browse the repository at this point in the history
  • Loading branch information
pykettk authored Oct 31, 2022
1 parent c36a787 commit a4a20d4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions view/frontend/templates/canvas.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,13 @@ $canvasBlockName = $canvasViewModel->getCanvasBlockName($block);

submitCanvas()
{
this.canvasImage = this.canvas.toDataURL();
const canvasImage = this.canvas.toDataURL();

if (this.canvasImage !== this.canvasImageDefault) {
if (this.canvasImage !== this.canvasImageDefault
&& this.canvasImage !== canvasImage
) {
this.canvasImage = canvasImage;

window.dispatchEvent(new CustomEvent(
'customer-canvas-submitted',
{
Expand Down

0 comments on commit a4a20d4

Please sign in to comment.