mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 14:10:14 -05:00
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:
parent
e21ea457a7
commit
d6fceb928f
2 changed files with 15 additions and 3 deletions
|
@ -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();
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue