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:
@@ -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)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user