mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Rename Item#transformContent to #applyMatrix.
This commit is contained in:
parent
9d47bfcf0b
commit
b54bdadaff
3 changed files with 12 additions and 10 deletions
|
@ -28,7 +28,7 @@
|
|||
|
||||
// Create the group of circle shaped paths and scale it up a bit:
|
||||
var group = createPhyllotaxis(values.amount);
|
||||
group.transformContent = true;
|
||||
group.applyMatrix = true;
|
||||
group.scale(3);
|
||||
|
||||
function createPhyllotaxis(amount) {
|
||||
|
|
|
@ -91,7 +91,8 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{
|
|||
|
||||
// Only for external sources, e.g. Raster
|
||||
onLoad: {}
|
||||
});
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
initialize: function(pointOrMatrix) {
|
||||
|
@ -387,7 +388,7 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{
|
|||
* @type Boolean
|
||||
* @default false
|
||||
*/
|
||||
transformContent: false,
|
||||
applyMatrix: false,
|
||||
|
||||
/**
|
||||
* Specifies whether an item is selected and will also return {@code true}
|
||||
|
@ -1861,12 +1862,12 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{
|
|||
if (this._transform)
|
||||
this._transform(matrix);
|
||||
// If we need to directly apply the accumulated transformations, call
|
||||
// #applyMatrix() with the internal _,atrix, and set it to the identity
|
||||
// #_applyMatrix() with the internal _matrix, and set it to the identity
|
||||
// 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.transformContent || arguments[1])
|
||||
&& this.applyMatrix(this._matrix))
|
||||
if ((this.applyMatrix || 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();
|
||||
|
@ -1899,7 +1900,7 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{
|
|||
return this;
|
||||
},
|
||||
|
||||
applyMatrix: function(matrix) {
|
||||
_applyMatrix: function(matrix) {
|
||||
// Pass on the transformation to the children, and apply it there too:
|
||||
if (this._children) {
|
||||
for (var i = 0, l = this._children.length; i < l; i++)
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
// DOCS: Explain that path matrix is always applied with each transformation.
|
||||
var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
||||
_type: 'path',
|
||||
// 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.
|
||||
|
@ -249,7 +247,10 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
|||
return true;
|
||||
},
|
||||
|
||||
applyMatrix: function(matrix) {
|
||||
// Paths directly apply transformation matrices to the Segments by default.
|
||||
applyMatrix: true,
|
||||
|
||||
_applyMatrix: 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);
|
||||
|
|
Loading…
Reference in a new issue