From 5e129d1a3839596fe6a83afca17d51cba7061a8a Mon Sep 17 00:00:00 2001 From: ShaMan123 Date: Mon, 7 Mar 2022 00:10:27 +0200 Subject: [PATCH] flipX --- src/mixins/object_geometry.mixin.js | 2 +- src/shapes/object.class.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mixins/object_geometry.mixin.js b/src/mixins/object_geometry.mixin.js index 6b4c2aa9b19..4604b5f9601 100644 --- a/src/mixins/object_geometry.mixin.js +++ b/src/mixins/object_geometry.mixin.js @@ -568,7 +568,7 @@ calcOCoords: function() { var vpt = this.getViewportTransform(), tMatrix = this._calcTranslateMatrix(true), - rMatrix = this._calcRotateMatrix(true, !!this.group), + rMatrix = this._calcRotateMatrix(true, true), positionMatrix = multiplyMatrices(tMatrix, rMatrix), startMatrix = multiplyMatrices(vpt, positionMatrix), finalMatrix = multiplyMatrices(startMatrix, [1 / vpt[0], 0, 0, 1 / vpt[3], 0, 0]), diff --git a/src/shapes/object.class.js b/src/shapes/object.class.js index 57f1f1aaf48..11368beebc1 100644 --- a/src/shapes/object.class.js +++ b/src/shapes/object.class.js @@ -1387,7 +1387,7 @@ _renderControls: function(ctx, styleOverride) { var vpt = this.getViewportTransform(), matrix = this.calcTransformMatrix(), - options, drawBorders, drawControls; + options, drawBorders, drawControls, angle; styleOverride = styleOverride || { }; drawBorders = typeof styleOverride.hasBorders !== 'undefined' ? styleOverride.hasBorders : this.hasBorders; drawControls = typeof styleOverride.hasControls !== 'undefined' ? styleOverride.hasControls : this.hasControls; @@ -1399,10 +1399,11 @@ if (!this.group) { ctx.globalAlpha = this.isMoving ? this.borderOpacityWhenMoving : 1; } + angle = this.group ? options.angle : this.angle; if (this.flipX) { - options.angle -= 180; + angle -= 180; } - ctx.rotate(degreesToRadians(this.group ? options.angle : this.angle)); + ctx.rotate(degreesToRadians(angle)); if (drawBorders && (styleOverride.forActiveSelection || this.group)) { this.drawBordersInGroup(ctx, options, styleOverride); }