Updating getBBox and anchor code to improve performance

This change will reduce the number of calls to this.container.getBBox
when calculating the bounding box of a node
This commit is contained in:
Jeff Avallone
2015-04-16 17:13:12 -04:00
parent 5601c6a398
commit 5917d2b035
8 changed files with 30 additions and 45 deletions
+1 -4
View File
@@ -6,12 +6,9 @@ export default {
definedProperties: {
_anchor: {
get: function() {
var box = this.container.getBBox(),
matrix = this.transform().localMatrix;
var matrix = this.transform().localMatrix;
return {
ax: box.x,
ax2: box.x2,
ay: matrix.y(0, this.partContainer.getBBox().cy)
};
}
+1 -1
View File
@@ -6,7 +6,7 @@ export default {
definedProperties: {
_anchor: {
get: function() {
var anchor = this.content.anchor,
var anchor = this.content.getBBox(),
matrix = this.transform().localMatrix;
return {
+2 -10
View File
@@ -34,23 +34,15 @@ export default class Node {
}
get anchor() {
var box;
if (this.proxy) {
return this.proxy.anchor;
} else {
box = this.container.getBBox();
return _.extend({
ax: box.x,
ax2: box.x2,
ay: box.cy
}, this._anchor || {});
return this._anchor || {};
}
}
getBBox() {
return _.extend(this.container.getBBox(), this.anchor);
return _.extend(util.normalizeBBox(this.container.getBBox()), this.anchor);
}
transform(matrix) {
+1 -1
View File
@@ -6,7 +6,7 @@ export default {
definedProperties: {
_anchor: {
get: function() {
var anchor = this.regexp.anchor,
var anchor = this.regexp.getBBox(),
matrix = this.transform().localMatrix;
return {