Make sure _globalMatrix is not set to false values in Item#rasterize().

This commit is contained in:
Jürg Lehni 2013-10-29 17:37:45 +01:00
parent ccfacf2484
commit b2188be567
2 changed files with 9 additions and 2 deletions

View file

@ -3160,7 +3160,9 @@ var Item = Base.extend(Callback, /** @lends Item# */{
var transforms = param.transforms,
parentMatrix = transforms[transforms.length - 1],
globalMatrix = parentMatrix.clone().concatenate(this._matrix);
transforms.push(this._globalMatrix = globalMatrix);
// Only keep track of transformation if told so. See Project#draw()
if (param.trackTransforms)
transforms.push(this._globalMatrix = globalMatrix);
// If the item has a blendMode or is defining an opacity, draw it on
// a temporary canvas first and composite the canvas afterwards.
// Paths with an opacity < 1 that both define a fillColor

View file

@ -370,7 +370,12 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
offset: new Point(0, 0),
// A stack of concatenated matrices, to keep track of the current
// global matrix, since Canvas is not able tell us (yet).
transforms: [matrix]
transforms: [matrix],
// Tell the drawing routine that we want to track nested matrices
// in param.transforms, and that we want it to set _globalMatrix
// as used below. Item#rasterize() and Raster#getAverageColor() do
// not need to set this.
trackTransforms: true
});
for (var i = 0, l = this.layers.length; i < l; i++)
this.layers[i].draw(ctx, param);