diff --git a/src/item/Item.js b/src/item/Item.js index 8db06893..2a6a59af 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -1830,7 +1830,7 @@ function(name) { if (this._transform) this._transform(matrix); if (apply) - this.applyMatrix(); + this.apply(); // We always need to call _changed since we're caching bounds on all // items, including Group. this._changed(Change.GEOMETRY); @@ -1856,14 +1856,15 @@ function(name) { return this; }, - applyMatrix: function() { - // Call the internal #_applyMatrix(), and set the internal _matrix to - // the identity transformation if it was possible to apply it. + // DOCS: Document #apply() + apply: function() { + // Call the internal #_apply(), and set the internal _matrix 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. - // Pass on this._matrix to _applyMatrix calls, for reasons of faster - // access and code minification. - if (this._applyMatrix(this._matrix)) { + // Pass on this._matrix to _apply calls, for reasons of faster access + // and code minification. + if (this._apply(this._matrix)) { // Set _matrix to the identity this._matrix.setIdentity(); // TODO: This needs a _changed notification, but the GEOMETRY @@ -1871,13 +1872,13 @@ function(name) { } }, - _applyMatrix: function(matrix) { + _apply: 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++) { var child = this._children[i]; child.transform(matrix); - child.applyMatrix(); + child.apply(); } return true; } diff --git a/src/path/Path.js b/src/path/Path.js index 8a2586a5..d630c8ea 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -206,7 +206,7 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{ // path, with the added benefit that b can be < a, and closed looping is // taken into account. - _applyMatrix: function(matrix) { + _apply: 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/test/tests/Path_Bounds.js b/test/tests/Path_Bounds.js index 00c12e71..fe0d0a96 100644 --- a/test/tests/Path_Bounds.js +++ b/test/tests/Path_Bounds.js @@ -54,7 +54,7 @@ test('path.bounds', function() { // Set new bounds and check segment list as result of resizing / positioning path.bounds = { x: 100, y: 100, width: 200, height: 200 }; - path.applyMatrix(); + path.apply(); equals(path.segments.toString(), '{ point: { x: 107.93077, y: 179.56917 }, handleIn: { x: -24.41127, y: 51.30707 }, handleOut: { x: 39.52904, y: -83.08194 } },{ point: { x: 271.10084, y: 160.66656 }, handleIn: { x: -53.96176, y: -99.91377 }, handleOut: { x: 53.96176, y: 99.91377 } },{ point: { x: 215.85428, y: 296.96086 }, handleIn: { x: 85.81084, y: -17.18521 }, handleOut: { x: -101.49949, y: 20.32729 } }', 'resized path.segments'); @@ -65,7 +65,7 @@ test('path.bounds', function() { { x: 92.38109, y: 106.78957, width: 191.4803, height: 203.66878 }, 'rotated path.bounds'); - path.applyMatrix(); + path.apply(); equals(path.segments.toString(), '{ point: { x: 142.60356, y: 125.16811 }, handleIn: { x: -51.67967, y: 23.61224 }, handleOut: { x: 83.68504, y: -38.23568 } },{ point: { x: 279.74945, y: 215.57158 }, handleIn: { x: 22.88623, y: -111.22434 }, handleOut: { x: -22.88623, y: 111.22434 } },{ point: { x: 149.81984, y: 284.46726 }, handleIn: { x: 76.78135, y: 41.99351 }, handleOut: { x: -90.81925, y: -49.67101 } }', 'roated path.segments');