diff --git a/src/Container.js b/src/Container.js index 41706070..955b4828 100644 --- a/src/Container.js +++ b/src/Container.js @@ -287,7 +287,7 @@ clipY = this.getClipY(); context.save(); - context._applyTransform(this); + context._applyTransform(this, canvas.isCache); context.beginPath(); context.rect(clipX, clipY, clipWidth, clipHeight); context.clip(); diff --git a/src/Context.js b/src/Context.js index 610b9af5..c79abe92 100644 --- a/src/Context.js +++ b/src/Context.js @@ -223,12 +223,17 @@ this.setAttr('lineJoin', lineJoin); } }, - _applyTransform: function(shape) { + _applyTransform: function(shape, isCacheCanvas) { var transformsEnabled = shape.getTransformsEnabled(), m; if (transformsEnabled === 'all') { - m = shape.getAbsoluteTransform().getMatrix(); + if (isCacheCanvas) { + // don't apply parents' transform on cache canvas + m = shape.getTransform().getMatrix(); + } else { + m = shape.getAbsoluteTransform().getMatrix(); + } this.transform(m[0], m[1], m[2], m[3], m[4], m[5]); } else if (transformsEnabled === 'position') { diff --git a/src/Node.js b/src/Node.js index 66cc9ef9..428265c1 100644 --- a/src/Node.js +++ b/src/Node.js @@ -168,6 +168,9 @@ origY = this.y(), sceneContext; + cachedSceneCanvas.isCache = true; + cachedHitCanvas.isCache = true; + this.clearCache(); this.transformsEnabled('position'); diff --git a/src/Shape.js b/src/Shape.js index dee75db4..9042bc9e 100644 --- a/src/Shape.js +++ b/src/Shape.js @@ -154,7 +154,7 @@ bufferContext.clear(); bufferContext.save(); bufferContext._applyLineJoin(this); - bufferContext._applyTransform(this); + bufferContext._applyTransform(this, canvas.isCache); drawFunc.call(this, bufferContext); bufferContext.restore(); @@ -172,7 +172,7 @@ // if buffer canvas is not needed else { context._applyLineJoin(this); - context._applyTransform(this); + context._applyTransform(this, canvas.isCache); if (hasShadow) { context.save(); @@ -205,7 +205,7 @@ else if (drawFunc) { context.save(); context._applyLineJoin(this); - context._applyTransform(this); + context._applyTransform(this, canvas.isCache); drawFunc.call(this, context); context.restore();