Implement Item#transformContent property, which controls wether Item#transform() directly applies transformations to contents, or simply stores them in Item#matrix.

This commit is contained in:
Jürg Lehni 2012-12-24 00:39:42 +01:00
parent e21ea457a7
commit d6fceb928f
2 changed files with 15 additions and 3 deletions

View file

@ -379,6 +379,16 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{
*/
_guide: false,
/**
* Specifies whether the item directly transforms its contents when
* transformations are applied to it, or wether it simply stores them in
* {@link Item#matrix}.
*
* @type Boolean
* @default false
*/
transformContent: false,
/**
* Specifies whether an item is selected and will also return {@code true}
* if the item is partially selected (groups with some selected or partially
@ -1855,7 +1865,8 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{
// transformation if it was possible to apply it. Application is not
// possible on Raster, PointText, PlacedSymbol, since the matrix is
// storing the actual location / transformation state.
if ((this._applyMatrix || arguments[1]) && this.applyMatrix(this._matrix))
if ((this.transformContent || arguments[1])
&& this.applyMatrix(this._matrix))
// TODO: This needs a _changed notification, but the GEOMETRY
// actually doesn't change! What to do?
this._matrix.setIdentity();

View file

@ -24,8 +24,9 @@
// DOCS: Explain that path matrix is always applied with each transformation.
var Path = this.Path = PathItem.extend(/** @lends Path# */{
_type: 'path',
// Paths always directly apply transformation matrices to the Segments.
_applyMatrix: true,
// Paths directly apply transformation matrices to the Segments by default.
transformContent: true,
/**
* Creates a new Path item and places it at the top of the active layer.
*