More fabric.Group refactoring

This commit is contained in:
kangax 2013-11-10 17:43:23 +01:00
parent 1ecbf379ff
commit f421979e80
5 changed files with 63 additions and 48 deletions

35
dist/all.js vendored
View file

@ -16807,11 +16807,9 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
_calcBounds: function() {
var aX = [],
aY = [],
minX, minY, maxX, maxY, o, width, height,
i = 0,
len = this._objects.length;
o;
for (; i < len; ++i) {
for (var i = 0, len = this._objects.length; i < len; ++i) {
o = this._objects[i];
o.setCoords();
for (var prop in o.oCoords) {
@ -16820,19 +16818,26 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
}
}
minX = min(aX);
maxX = max(aX);
minY = min(aY);
maxY = max(aY);
this.set(this._getBounds(aX, aY));
},
width = (maxX - minX) || 0;
height = (maxY - minY) || 0;
/**
* @private
*/
_getBounds: function(aX, aY) {
var minX = min(aX),
maxX = max(aX),
minY = min(aY),
maxY = max(aY),
width = (maxX - minX) || 0,
height = (maxY - minY) || 0;
this.width = width;
this.height = height;
this.left = (minX + width / 2) || 0;
this.top = (minY + height / 2) || 0;
return {
width: width,
height: height,
left: (minX + width / 2) || 0,
top: (minY + height / 2) || 0
};
},
/* _TO_SVG_START_ */

6
dist/all.min.js vendored

File diff suppressed because one or more lines are too long

BIN
dist/all.min.js.gz vendored

Binary file not shown.

35
dist/all.require.js vendored
View file

@ -16807,11 +16807,9 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
_calcBounds: function() {
var aX = [],
aY = [],
minX, minY, maxX, maxY, o, width, height,
i = 0,
len = this._objects.length;
o;
for (; i < len; ++i) {
for (var i = 0, len = this._objects.length; i < len; ++i) {
o = this._objects[i];
o.setCoords();
for (var prop in o.oCoords) {
@ -16820,19 +16818,26 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
}
}
minX = min(aX);
maxX = max(aX);
minY = min(aY);
maxY = max(aY);
this.set(this._getBounds(aX, aY));
},
width = (maxX - minX) || 0;
height = (maxY - minY) || 0;
/**
* @private
*/
_getBounds: function(aX, aY) {
var minX = min(aX),
maxX = max(aX),
minY = min(aY),
maxY = max(aY),
width = (maxX - minX) || 0,
height = (maxY - minY) || 0;
this.width = width;
this.height = height;
this.left = (minX + width / 2) || 0;
this.top = (minY + height / 2) || 0;
return {
width: width,
height: height,
left: (minX + width / 2) || 0,
top: (minY + height / 2) || 0
};
},
/* _TO_SVG_START_ */

View file

@ -434,11 +434,9 @@
_calcBounds: function() {
var aX = [],
aY = [],
minX, minY, maxX, maxY, o, width, height,
i = 0,
len = this._objects.length;
o;
for (; i < len; ++i) {
for (var i = 0, len = this._objects.length; i < len; ++i) {
o = this._objects[i];
o.setCoords();
for (var prop in o.oCoords) {
@ -447,19 +445,26 @@
}
}
minX = min(aX);
maxX = max(aX);
minY = min(aY);
maxY = max(aY);
this.set(this._getBounds(aX, aY));
},
width = (maxX - minX) || 0;
height = (maxY - minY) || 0;
/**
* @private
*/
_getBounds: function(aX, aY) {
var minX = min(aX),
maxX = max(aX),
minY = min(aY),
maxY = max(aY),
width = (maxX - minX) || 0,
height = (maxY - minY) || 0;
this.width = width;
this.height = height;
this.left = (minX + width / 2) || 0;
this.top = (minY + height / 2) || 0;
return {
width: width,
height: height,
left: (minX + width / 2) || 0,
top: (minY + height / 2) || 0
};
},
/* _TO_SVG_START_ */