From 2d35b3f8ff56974532fb4b059a8b743b6696651b Mon Sep 17 00:00:00 2001 From: Paul Conlin Date: Fri, 6 Mar 2020 09:22:14 -0600 Subject: [PATCH 1/2] Adding existence check for this.canvas on object stacking methods --- src/mixins/object_stacking.mixin.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mixins/object_stacking.mixin.js b/src/mixins/object_stacking.mixin.js index c2c2b0f8bf3..cfda8e9e6ba 100644 --- a/src/mixins/object_stacking.mixin.js +++ b/src/mixins/object_stacking.mixin.js @@ -9,7 +9,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot if (this.group) { fabric.StaticCanvas.prototype.sendToBack.call(this.group, this); } - else { + else (this.canvas) { this.canvas.sendToBack(this); } return this; @@ -24,7 +24,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot if (this.group) { fabric.StaticCanvas.prototype.bringToFront.call(this.group, this); } - else { + else (this.canvas) { this.canvas.bringToFront(this); } return this; @@ -40,7 +40,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot if (this.group) { fabric.StaticCanvas.prototype.sendBackwards.call(this.group, this, intersecting); } - else { + else (this.canvas) { this.canvas.sendBackwards(this, intersecting); } return this; @@ -56,7 +56,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot if (this.group) { fabric.StaticCanvas.prototype.bringForward.call(this.group, this, intersecting); } - else { + else (this.canvas) { this.canvas.bringForward(this, intersecting); } return this; @@ -72,7 +72,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot if (this.group && this.group.type !== 'activeSelection') { fabric.StaticCanvas.prototype.moveTo.call(this.group, this, index); } - else { + else (this.canvas) { this.canvas.moveTo(this, index); } return this; From dbd8bb9e128f3371772af9cab7eec3d163a901eb Mon Sep 17 00:00:00 2001 From: Paul Conlin Date: Mon, 9 Mar 2020 09:14:38 -0500 Subject: [PATCH 2/2] Fix my dumb mistake --- src/mixins/object_stacking.mixin.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mixins/object_stacking.mixin.js b/src/mixins/object_stacking.mixin.js index cfda8e9e6ba..8c8e87d5efd 100644 --- a/src/mixins/object_stacking.mixin.js +++ b/src/mixins/object_stacking.mixin.js @@ -9,7 +9,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot if (this.group) { fabric.StaticCanvas.prototype.sendToBack.call(this.group, this); } - else (this.canvas) { + else if (this.canvas) { this.canvas.sendToBack(this); } return this; @@ -24,7 +24,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot if (this.group) { fabric.StaticCanvas.prototype.bringToFront.call(this.group, this); } - else (this.canvas) { + else if (this.canvas) { this.canvas.bringToFront(this); } return this; @@ -40,7 +40,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot if (this.group) { fabric.StaticCanvas.prototype.sendBackwards.call(this.group, this, intersecting); } - else (this.canvas) { + else if (this.canvas) { this.canvas.sendBackwards(this, intersecting); } return this; @@ -56,7 +56,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot if (this.group) { fabric.StaticCanvas.prototype.bringForward.call(this.group, this, intersecting); } - else (this.canvas) { + else if (this.canvas) { this.canvas.bringForward(this, intersecting); } return this; @@ -72,7 +72,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot if (this.group && this.group.type !== 'activeSelection') { fabric.StaticCanvas.prototype.moveTo.call(this.group, this, index); } - else (this.canvas) { + else if (this.canvas) { this.canvas.moveTo(this, index); } return this;