Rename #_applyMatrix to #_transformContent.

And swap names with private function...
This commit is contained in:
Jürg Lehni 2013-06-18 15:50:11 -07:00
parent d7d6da0af8
commit f758fb306b
7 changed files with 11 additions and 11 deletions

View file

@ -21,7 +21,7 @@
* @extends Group
*/
var Clip = Group.extend(/** @lends Clip# */{
_applyMatrix: false,
_transformContent: false,
initialize: function Clip() {
Group.apply(this, arguments);

View file

@ -98,7 +98,7 @@ var Group = Item.extend(/** @lends Group# */{
_changed: function _changed(flags) {
_changed.base.call(this, flags);
if (flags & /*#=*/ ChangeFlag.HIERARCHY && this._applyMatrix
if (flags & /*#=*/ ChangeFlag.HIERARCHY && this._transformContent
&& !this._matrix.isIdentity()) {
// Apply matrix now that we have content.
this.applyMatrix();

View file

@ -43,7 +43,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{
// All items apply their matrix by default.
// Exceptions are Raster, PlacedSymbol, Clip and Shape.
_applyMatrix: true,
_transformContent: true,
_boundsSelected: false,
// Provide information about fields to be serialized, with their defaults
// that can be ommited.
@ -2219,7 +2219,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{
this._matrix.preConcatenate(matrix);
// Call applyMatrix if we need to directly apply the accumulated
// transformations to the item's content.
if (this._applyMatrix || arguments[1])
if (this._transformContent || arguments[1])
this.applyMatrix(true);
// We always need to call _changed since we're caching bounds on all
// items, including Group.
@ -2250,7 +2250,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{
return this;
},
_transformContent: function(matrix, applyMatrix) {
_applyMatrix: function(matrix, applyMatrix) {
var children = this._children;
if (children && children.length > 0) {
for (var i = 0, l = children.length; i < l; i++)
@ -2260,14 +2260,14 @@ var Item = Base.extend(Callback, /** @lends Item# */{
},
applyMatrix: function(_dontNotify) {
// Call #_transformContent() with the internal _matrix and pass true for
// Call #_applyMatrix() with the internal _matrix and pass true for
// applyMatrix. Application is not possible on Raster, PointText,
// PlacedSymbol, since the matrix is where the actual location /
// transformation state is stored.
// Pass on the transformation to the content, and apply it there too,
// by passing true for the 2nd hidden parameter.
var matrix = this._matrix;
if (this._transformContent(matrix, true)) {
if (this._applyMatrix(matrix, true)) {
// When the matrix could be applied, we also need to transform
// color styles with matrices (only gradients so far):
var style = this._style,

View file

@ -19,7 +19,7 @@
* @extends Item
*/
var PlacedSymbol = Item.extend(/** @lends PlacedSymbol# */{
_applyMatrix: false,
_transformContent: false,
// PlacedSymbol uses strokeBounds for bounds
_boundsGetter: { getBounds: 'getStrokeBounds' },
_boundsSelected: true,

View file

@ -18,7 +18,7 @@
* @extends Item
*/
var Raster = Item.extend(/** @lends Raster# */{
_applyMatrix: false,
_transformContent: false,
// Raster doesn't make the distinction between the different bounds,
// so use the same name for all of them
_boundsGetter: 'getBounds',

View file

@ -18,7 +18,7 @@
* @extends Item
*/
var Shape = Item.extend(/** @lends Shape# */{
_applyMatrix: false,
_transformContent: false,
initialize: function Shape(type, point, size) {
Item.call(this, point);

View file

@ -295,7 +295,7 @@ var Path = PathItem.extend(/** @lends Path# */{
return true;
},
_transformContent: function(matrix) {
_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);