diff --git a/src/item/Item.js b/src/item/Item.js index aa18e094..93d1fec3 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -2151,8 +2151,18 @@ var Item = this.Item = Base.extend(Callback, { // possible on Raster, PointText, PlacedSymbol, since the matrix is // storing the actual location / transformation state. if ((this.applyMatrix || arguments[1]) - && this._applyMatrix(this._matrix)) + && this._applyMatrix(this._matrix)) { + // When the matrix could be applied, we also need to transform + // color styles with matrices (only gradients so far): + var style = this._style, + fillColor = style._fillColor, + strokeColor = style._strokeColor; + if (fillColor) + fillColor.transform(this._matrix); + if (strokeColor) + strokeColor.transform(this._matrix); this._matrix.reset(); + } // We always need to call _changed since we're caching bounds on all // items, including Group. this._changed(/*#=*/ Change.GEOMETRY); diff --git a/src/path/Path.js b/src/path/Path.js index d5b3f232..00078c84 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -304,19 +304,8 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{ _applyMatrix: function(matrix) { 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); - } - // See #draw() for an explanation of why we can access _style properties - // directly here: - var style = this._style, - fillColor = style._fillColor, - strokeColor = style._strokeColor; - // Try calling transform on colors in case they are gradients. - if (fillColor && fillColor._type === 'gradient') - fillColor.transform(matrix); - if (strokeColor && strokeColor._type === 'gradient') - strokeColor.transform(matrix); return true; },