mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Make sure _globalMatrix is not set to false values in Item#rasterize().
This commit is contained in:
parent
ccfacf2484
commit
b2188be567
2 changed files with 9 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue