diff --git a/src/item/Group.js b/src/item/Group.js index 67628dee..ecf48d46 100644 --- a/src/item/Group.js +++ b/src/item/Group.js @@ -120,8 +120,11 @@ var Group = this.Group = Item.extend(/** @lends Group# */{ draw: function(ctx, param) { var clipItem = this._getClipItem(); - if (clipItem) + if (clipItem) { + param.clipping = true; Item.draw(clipItem, ctx, param); + delete param.clipping; + } for (var i = 0, l = this._children.length; i < l; i++) { var item = this._children[i]; if (item != clipItem) diff --git a/src/item/Item.js b/src/item/Item.js index 8ae10e7d..eee96c77 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -2449,14 +2449,16 @@ function(name) { // so we draw onto it, instead of the parentCtx ctx = tempCanvas.getContext('2d'); } - ctx.save(); + if (!param.clipping) + ctx.save(); // Translate the context so the topLeft of the item is at (0, 0) // on the temporary canvas. if (tempCanvas) ctx.translate(-itemOffset.x, -itemOffset.y); item._matrix.applyToContext(ctx); item.draw(ctx, param); - ctx.restore(); + if (!param.clipping) + ctx.restore(); // If we created a temporary canvas before, composite it onto the // parent canvas: if (tempCanvas) {