demos/Collage/fabric.js
function(object) {

      var groupLeft = this.get('left'),
          groupTop = this.get('top'),
          groupAngle = this.getAngle() * (Math.PI / 180),
          objectLeft = object.get('originalLeft'),
          objectTop = object.get('originalTop'),
          rotatedTop = Math.cos(groupAngle) * object.get('top') + Math.sin(groupAngle) * object.get('left'),
          rotatedLeft = -Math.sin(groupAngle) * object.get('top') + Math.cos(groupAngle) * object.get('left');

      object.setAngle(object.getAngle() + this.getAngle());

      object.set('left', groupLeft + rotatedLeft * this.get('scaleX'));
      object.set('top', groupTop + rotatedTop * this.get('scaleY'));

      object.set('scaleX', object.get('scaleX') * this.get('scaleX'));
      object.set('scaleY', object.get('scaleY') * this.get('scaleY'));

      object.setCoords();
      object.hideCorners = false;
      object.setActive(false);
      object.setCoords();

      return this;
    }
function(object) {

      var groupLeft = this.get('left'),
          groupTop = this.get('top'),
          groupAngle = this.getAngle() * (Math.PI / 180),
          objectLeft = object.get('originalLeft'),
          objectTop = object.get('originalTop'),
          rotatedTop = Math.cos(groupAngle) * object.get('top') + Math.sin(groupAngle) * object.get('left'),
          rotatedLeft = -Math.sin(groupAngle) * object.get('top') + Math.cos(groupAngle) * object.get('left');

      object.setAngle(object.getAngle() + this.getAngle());

      object.set('left', groupLeft + rotatedLeft * this.get('scaleX'));
      object.set('top', groupTop + rotatedTop * this.get('scaleY'));

      object.set('scaleX', object.get('scaleX') * this.get('scaleX'));
      object.set('scaleY', object.get('scaleY') * this.get('scaleY'));

      object.setCoords();
      object.hideCorners = false;
      object.setActive(false);
      object.setCoords();

      return this;
    }
function ( object ) { var groupLeft = this . get ( 'left' ) , groupTop = this . get ( 'top' ) , groupAngle = this . getAngle ( ) * ( Math . PI / 180 ) , objectLeft = object . get ( 'originalLeft' ) , objectTop = object . get ( 'originalTop' ) , rotatedTop = Math . cos ( groupAngle ) * object . get ( 'top' ) + Math . sin ( groupAngle ) * object . get ( 'left' ) , rotatedLeft = - Math . sin ( groupAngle ) * object . get ( 'top' ) + Math . cos ( groupAngle ) * object . get ( 'left' ) ; object . setAngle ( object . getAngle ( ) + this . getAngle ( ) ) ; object . set ( 'left' , groupLeft + rotatedLeft * this . get ( 'scaleX' ) ) ; object . set ( 'top' , groupTop + rotatedTop * this . get ( 'scaleY' ) ) ; object . set ( 'scaleX' , object . get ( 'scaleX' ) * this . get ( 'scaleX' ) ) ; object . set ( 'scaleY' , object . get ( 'scaleY' ) * this . get ( 'scaleY' ) ) ; object . setCoords ( ) ; object . hideCorners = false ; object . setActive ( false ) ; object . setCoords ( ) ; return this ; }
Restores original state of a specified object in group
@private
@method _restoreObjectState
@param {fabric.Object} object
@return {fabric.Group} thisArg
Restores original state of a specified object in group