mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Fix a bug in code that keeps #_position cache up to date.
Only happened in items that assign another type to 'bounds' through _boundsType, e.g. PlacedSymbol, leading to substantial slow downs.
This commit is contained in:
parent
28806fe977
commit
873cd79517
1 changed files with 7 additions and 3 deletions
|
@ -1849,11 +1849,15 @@ function(name) {
|
||||||
// in _bounds and transform each.
|
// in _bounds and transform each.
|
||||||
for (var key in bounds) {
|
for (var key in bounds) {
|
||||||
var rect = bounds[key];
|
var rect = bounds[key];
|
||||||
// If we have cached 'bounds', update _position again
|
|
||||||
if (key == 'bounds')
|
|
||||||
this._position = rect.getCenter(true);
|
|
||||||
bounds[key] = matrix._transformBounds(rect, rect);
|
bounds[key] = matrix._transformBounds(rect, rect);
|
||||||
}
|
}
|
||||||
|
// If we have cached 'bounds', update _position again as its
|
||||||
|
// center. We need to take into account _boundsType here too, in
|
||||||
|
// case another type is assigned to it, e.g. 'strokeBounds'.
|
||||||
|
var type = this._boundsType,
|
||||||
|
rect = bounds[type && type.bounds || 'bounds'];
|
||||||
|
if (rect)
|
||||||
|
this._position = rect.getCenter(true);
|
||||||
} else if (position) {
|
} else if (position) {
|
||||||
// Transform position as well.
|
// Transform position as well.
|
||||||
this._position = matrix._transformPoint(position, position);
|
this._position = matrix._transformPoint(position, position);
|
||||||
|
|
Loading…
Reference in a new issue