mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Make sure that #transformContent can only be set to true on items that actually support it.
This commit is contained in:
parent
1a836a168f
commit
4ba17127aa
4 changed files with 9 additions and 6 deletions
|
@ -54,6 +54,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{
|
|||
// All items apply their matrix by default.
|
||||
// Exceptions are Raster, PlacedSymbol, Clip and Shape.
|
||||
_transformContent: true,
|
||||
_canTransformContent: true,
|
||||
_boundsSelected: false,
|
||||
_selectChildren: false,
|
||||
// Provide information about fields to be serialized, with their defaults
|
||||
|
@ -1173,8 +1174,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{
|
|||
},
|
||||
|
||||
setTransformContent: function(transform) {
|
||||
this._transformContent = !!transform;
|
||||
if (transform)
|
||||
if (this._transformContent = this._canTransformContent && !!transform)
|
||||
this.applyMatrix();
|
||||
},
|
||||
|
||||
|
@ -1986,8 +1986,8 @@ var Item = Base.extend(Callback, /** @lends Item# */{
|
|||
// Only pass on the transformContent setting if it's different
|
||||
// and the child has not its onw setting already.
|
||||
if (item._transformContent ^ transformContent
|
||||
&& !item.hasOwnProperty('_transformContent'))
|
||||
item.setTransformContent(transformContent)
|
||||
&& !item.hasOwnProperty('_transformContent'))
|
||||
item.setTransformContent(transformContent);
|
||||
// Setting the name again makes sure all name lookup structures
|
||||
// are kept in sync.
|
||||
if (item._name)
|
||||
|
@ -2841,9 +2841,9 @@ var Item = Base.extend(Callback, /** @lends Item# */{
|
|||
// Reset the internal matrix to the identity transformation if it
|
||||
// was possible to apply it.
|
||||
matrix.reset(true);
|
||||
if (!_dontNotify)
|
||||
this._changed(/*#=*/ Change.GEOMETRY);
|
||||
}
|
||||
if (!_dontNotify)
|
||||
this._changed(/*#=*/ Change.GEOMETRY);
|
||||
return this;
|
||||
},
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
var PlacedSymbol = Item.extend(/** @lends PlacedSymbol# */{
|
||||
_class: 'PlacedSymbol',
|
||||
_transformContent: false,
|
||||
_canTransformContent: false,
|
||||
// PlacedSymbol uses strokeBounds for bounds
|
||||
_boundsGetter: { getBounds: 'getStrokeBounds' },
|
||||
_boundsSelected: true,
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
var Raster = Item.extend(/** @lends Raster# */{
|
||||
_class: 'Raster',
|
||||
_transformContent: false,
|
||||
_canTransformContent: false,
|
||||
// Raster doesn't make the distinction between the different bounds,
|
||||
// so use the same name for all of them
|
||||
_boundsGetter: 'getBounds',
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
var Shape = Item.extend(/** @lends Shape# */{
|
||||
_class: 'Shape',
|
||||
_transformContent: false,
|
||||
_canTransformContent: false,
|
||||
_boundsSelected: true,
|
||||
_serializeFields: {
|
||||
shape: null,
|
||||
|
|
Loading…
Reference in a new issue