mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -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:
|
// Create the group of circle shaped paths and scale it up a bit:
|
||||||
var group = createPhyllotaxis(values.amount);
|
var group = createPhyllotaxis(values.amount);
|
||||||
group.transformContent = true;
|
group.applyMatrix = true;
|
||||||
group.scale(3);
|
group.scale(3);
|
||||||
|
|
||||||
function createPhyllotaxis(amount) {
|
function createPhyllotaxis(amount) {
|
||||||
|
|
|
@ -91,7 +91,8 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{
|
||||||
|
|
||||||
// Only for external sources, e.g. Raster
|
// Only for external sources, e.g. Raster
|
||||||
onLoad: {}
|
onLoad: {}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function(pointOrMatrix) {
|
initialize: function(pointOrMatrix) {
|
||||||
|
@ -387,7 +388,7 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{
|
||||||
* @type Boolean
|
* @type Boolean
|
||||||
* @default false
|
* @default false
|
||||||
*/
|
*/
|
||||||
transformContent: false,
|
applyMatrix: false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies whether an item is selected and will also return {@code true}
|
* 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)
|
if (this._transform)
|
||||||
this._transform(matrix);
|
this._transform(matrix);
|
||||||
// If we need to directly apply the accumulated transformations, call
|
// 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
|
// transformation if it was possible to apply it. Application is not
|
||||||
// possible on Raster, PointText, PlacedSymbol, since the matrix is
|
// possible on Raster, PointText, PlacedSymbol, since the matrix is
|
||||||
// storing the actual location / transformation state.
|
// storing the actual location / transformation state.
|
||||||
if ((this.transformContent || arguments[1])
|
if ((this.applyMatrix || arguments[1])
|
||||||
&& this.applyMatrix(this._matrix))
|
&& this._applyMatrix(this._matrix))
|
||||||
// TODO: This needs a _changed notification, but the GEOMETRY
|
// TODO: This needs a _changed notification, but the GEOMETRY
|
||||||
// actually doesn't change! What to do?
|
// actually doesn't change! What to do?
|
||||||
this._matrix.setIdentity();
|
this._matrix.setIdentity();
|
||||||
|
@ -1899,7 +1900,7 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
applyMatrix: function(matrix) {
|
_applyMatrix: function(matrix) {
|
||||||
// Pass on the transformation to the children, and apply it there too:
|
// Pass on the transformation to the children, and apply it there too:
|
||||||
if (this._children) {
|
if (this._children) {
|
||||||
for (var i = 0, l = this._children.length; i < l; i++)
|
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.
|
// DOCS: Explain that path matrix is always applied with each transformation.
|
||||||
var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
||||||
_type: '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.
|
* 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;
|
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);
|
var coords = new Array(6);
|
||||||
for (var i = 0, l = this._segments.length; i < l; i++) {
|
for (var i = 0, l = this._segments.length; i < l; i++) {
|
||||||
this._segments[i]._transformCoordinates(matrix, coords, true);
|
this._segments[i]._transformCoordinates(matrix, coords, true);
|
||||||
|
|
Loading…
Reference in a new issue