diff --git a/examples/Animated/AnimatedStar.html b/examples/Animated/AnimatedStar.html index 34e9d62b..246294c8 100644 --- a/examples/Animated/AnimatedStar.html +++ b/examples/Animated/AnimatedStar.html @@ -29,7 +29,7 @@ path.smooth(); layer.insertChild(0, new Group({ children: [path], - transformContent: false + applyMatrix: false })); } diff --git a/examples/Paperjs.org/BouncingBalls.html b/examples/Paperjs.org/BouncingBalls.html index 79b39ffa..637e3920 100644 --- a/examples/Paperjs.org/BouncingBalls.html +++ b/examples/Paperjs.org/BouncingBalls.html @@ -42,7 +42,7 @@ this.item = new Group({ children: [ball], - transformContent: false, + applyMatrix: false, position: this.point }); } diff --git a/examples/Paperjs.org/PathIntersections.html b/examples/Paperjs.org/PathIntersections.html index da3db061..a793ba6a 100644 --- a/examples/Paperjs.org/PathIntersections.html +++ b/examples/Paperjs.org/PathIntersections.html @@ -11,11 +11,11 @@ var yesGroup = words.children.yes; var noGroup = words.children.no; - // Imported SVG Groups have their transformContent flag turned off by + // Imported SVG Groups have their applyMatrix flag turned off by // default. This is required for SVG importing to work correctly. Turn // it on now, so we don't have to deal with nested coordinate spaces. - yesGroup.transformContent = true; - noGroup.transformContent = true; + yesGroup.applyMatrix = true; + noGroup.applyMatrix = true; // Resize the words to fit snugly inside the view: project.activeLayer.fitBounds(view.bounds); diff --git a/examples/Paperjs.org/SatieLikedToDraw.html b/examples/Paperjs.org/SatieLikedToDraw.html index 4d165884..1e820173 100644 --- a/examples/Paperjs.org/SatieLikedToDraw.html +++ b/examples/Paperjs.org/SatieLikedToDraw.html @@ -27,7 +27,7 @@ var group = new Group({ children: [leftPath, rightPath], - transformContent: false, + applyMatrix: false, strokeWidth: 30, strokeJoin: 'round', strokeCap: 'butt', diff --git a/src/item/Item.js b/src/item/Item.js index f311841a..35f7e756 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -53,8 +53,8 @@ var Item = Base.extend(Callback, /** @lends Item# */{ _class: 'Item', // All items apply their matrix by default. // Exceptions are Raster, PlacedSymbol, Clip and Shape. - _transformContent: true, - _canTransformContent: true, + _applyMatrix: true, + _canApplyMatrix: true, _boundsSelected: false, _selectChildren: false, // Provide information about fields to be serialized, with their defaults @@ -70,7 +70,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{ guide: false, selected: false, clipMask: false, - transformContent: null, + applyMatrix: null, data: {} }, @@ -1134,7 +1134,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{ setMatrix: function(matrix) { // Use Matrix#initialize to easily copy over values. this._matrix.initialize(matrix); - if (this._transformContent) { + if (this._applyMatrix) { // Directly apply the internal matrix. This will also call // _changed() for us. this.transform(null, true); @@ -1173,17 +1173,24 @@ var Item = Base.extend(Callback, /** @lends Item# */{ * @default true * @bean */ - getTransformContent: function() { - return this._transformContent; + getApplyMatrix: function() { + return this._applyMatrix; }, - setTransformContent: function(transform) { - // Tell #transform() to apply the internal matrix if _transformContent + setApplyMatrix: function(transform) { + // Tell #transform() to apply the internal matrix if _applyMatrix // can be set to true. - if (this._transformContent = this._canTransformContent && !!transform) + if (this._applyMatrix = this._canApplyMatrix && !!transform) this.transform(null, true); }, + /** + * @bean + * @deprecated use {@link #getApplyMatrix()} instead. + */ + getTransformContent: '#getApplyMatrix', + setTransformContent: '#setApplyMatrix', + /** * {@grouptitle Project Hierarchy} * The project that this item belongs to. @@ -1492,7 +1499,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{ // meaning the default value has been overwritten (default is on // prototype). var keys = ['_locked', '_visible', '_blendMode', '_opacity', - '_clipMask', '_guide', '_transformContent']; + '_clipMask', '_guide', '_applyMatrix']; for (var i = 0, l = keys.length; i < l; i++) { var key = keys[i]; if (this.hasOwnProperty(key)) @@ -1984,16 +1991,16 @@ var Item = Base.extend(Callback, /** @lends Item# */{ } } Base.splice(children, items, index, 0); - var transformContent = this._transformContent; + var applyMatrix = this._applyMatrix; for (var i = 0, l = items.length; i < l; i++) { var item = items[i]; item._parent = this; item._setProject(this._project, true); - // Only pass on the transformContent setting if it's different + // Only pass on the applyMatrix setting if it's different // and the child has not its onw setting already. - if (item._transformContent ^ transformContent - && !item.hasOwnProperty('_transformContent')) - item.setTransformContent(transformContent); + if (item._applyMatrix ^ applyMatrix + && !item.hasOwnProperty('_applyMatrix')) + item.setApplyMatrix(applyMatrix); // Setting the name again makes sure all name lookup structures // are kept in sync. if (item._name) @@ -2059,6 +2066,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{ * the list of children and moving it above all other children. You can * use this function for groups, compound paths and layers. * + * @function * @param {Item} item The item to be appended as a child * @deprecated use {@link #addChild(item)} instead. */ @@ -2079,6 +2087,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{ /** * Moves this item above the specified item. * + * @function * @param {Item} item The item above which it should be moved * @return {Boolean} {@true if it was moved} * @deprecated use {@link #insertAbove(item)} instead. @@ -2088,6 +2097,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{ /** * Moves the item below the specified item. * + * @function * @param {Item} item the item below which it should be moved * @return {Boolean} {@true if it was moved} * @deprecated use {@link #insertBelow(item)} instead. @@ -2767,11 +2777,11 @@ var Item = Base.extend(Callback, /** @lends Item# */{ // 'lines'. Default: ['objects', 'children'] transform: function(matrix, _applyMatrix) { // If no matrix is provided, or the matrix is the identity, we might - // still have some work to do in case _transformContent is true + // still have some work to do in case _applyMatrix is true if (matrix && matrix.isIdentity()) matrix = null; var _matrix = this._matrix, - applyMatrix = (_applyMatrix || this._transformContent) + applyMatrix = (_applyMatrix || this._applyMatrix) // Don't apply _matrix if the result of concatenating with // matrix would be identity. && (!_matrix.isIdentity() || matrix); @@ -2781,11 +2791,11 @@ var Item = Base.extend(Callback, /** @lends Item# */{ // Simply preconcatenate the internal matrix with the passed one: if (matrix) _matrix.preConcatenate(matrix); - // Call #_applyMatrix() now, if we need to directly apply the internal - // _matrix transformations to the item's content. + // Call #_transformContent() now, if we need to directly apply the + // internal _matrix transformations to the item's content. // Application is not possible on Raster, PointText, PlacedSymbol, since // the matrix is where the actual transformation state is stored. - if (applyMatrix = applyMatrix && this._applyMatrix(_matrix)) { + if (applyMatrix = applyMatrix && this._transformContent(_matrix)) { // When the _matrix could be applied, we also need to transform // color styles (only gradients so far) and pivot point: var pivot = this._pivot, @@ -2841,7 +2851,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{ return this; }, - _applyMatrix: function(matrix) { + _transformContent: function(matrix) { var children = this._children; if (children) { for (var i = 0, l = children.length; i < l; i++) diff --git a/src/item/PlacedSymbol.js b/src/item/PlacedSymbol.js index 7d8f2067..b4e84050 100644 --- a/src/item/PlacedSymbol.js +++ b/src/item/PlacedSymbol.js @@ -20,8 +20,8 @@ */ var PlacedSymbol = Item.extend(/** @lends PlacedSymbol# */{ _class: 'PlacedSymbol', - _transformContent: false, - _canTransformContent: false, + _applyMatrix: false, + _canApplyMatrix: false, // PlacedSymbol uses strokeBounds for bounds _boundsGetter: { getBounds: 'getStrokeBounds' }, _boundsSelected: true, diff --git a/src/item/Raster.js b/src/item/Raster.js index 4dad6a2f..36b46bd5 100644 --- a/src/item/Raster.js +++ b/src/item/Raster.js @@ -19,8 +19,8 @@ */ var Raster = Item.extend(/** @lends Raster# */{ _class: 'Raster', - _transformContent: false, - _canTransformContent: false, + _applyMatrix: false, + _canApplyMatrix: false, // Raster doesn't make the distinction between the different bounds, // so use the same name for all of them _boundsGetter: 'getBounds', diff --git a/src/item/Shape.js b/src/item/Shape.js index c5eb1d5e..fa352958 100644 --- a/src/item/Shape.js +++ b/src/item/Shape.js @@ -19,8 +19,8 @@ */ var Shape = Item.extend(/** @lends Shape# */{ _class: 'Shape', - _transformContent: false, - _canTransformContent: false, + _applyMatrix: false, + _canApplyMatrix: false, _boundsSelected: true, _serializeFields: { shape: null, diff --git a/src/path/Path.js b/src/path/Path.js index ed88ca3f..b50815b2 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -347,7 +347,7 @@ var Path = PathItem.extend(/** @lends Path# */{ return true; }, - _applyMatrix: function(matrix) { + _transformContent: function(matrix) { var coords = new Array(6); for (var i = 0, l = this._segments.length; i < l; i++) this._segments[i]._transformCoordinates(matrix, coords, true); diff --git a/src/svg/SVGImport.js b/src/svg/SVGImport.js index 03c5b32e..1dc82912 100644 --- a/src/svg/SVGImport.js +++ b/src/svg/SVGImport.js @@ -81,7 +81,7 @@ new function() { if (!isClip) { // Have the group not pass on all transformations to its children, // as this is how SVG works too. - item._transformContent = false; + item._applyMatrix = false; item = applyAttributes(item, node, isRoot); // Style on items needs to be handled differently than all other // items: We first apply the style to the item, then use it as the diff --git a/src/text/TextItem.js b/src/text/TextItem.js index ab3a1ba3..e96ca968 100644 --- a/src/text/TextItem.js +++ b/src/text/TextItem.js @@ -24,7 +24,8 @@ var TextItem = Item.extend(/** @lends TextItem# */{ _class: 'TextItem', _boundsSelected: true, - _transformContent: false, + _applyMatrix: false, + _canApplyMatrix: false, _serializeFields: { content: null },