From 6e96b3f1fb45c4318dfb63822cb0abde3026f437 Mon Sep 17 00:00:00 2001 From: Fabian Ebner Date: Tue, 24 Sep 2013 12:38:11 +0200 Subject: [PATCH] Allow flipping in fabric.Group to change the object positions permanently --- src/shapes/group.class.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/shapes/group.class.js b/src/shapes/group.class.js index b3d90780..9b3b1d54 100644 --- a/src/shapes/group.class.js +++ b/src/shapes/group.class.js @@ -266,6 +266,19 @@ */ _restoreObjectState: function(object) { + var center = object.getCenterPoint(); + center.x *= -1; + center.y *= -1; + var newOrigin = object.translateToOriginPoint(center, object.get('originX'), object.get('originY')); + if (this.flipX) { + object.set('flipX', true); + object.set('left', newOrigin.x); + } + if (this.flipY) { + object.set('flipY', true); + object.set('top', newOrigin.y); + } + var groupLeft = this.get('left'), groupTop = this.get('top'), groupAngle = this.getAngle() * (Math.PI / 180),