From 1d9247ab3adbcbd849736acb7d8e985e14054b40 Mon Sep 17 00:00:00 2001 From: kangax Date: Thu, 26 May 2011 09:03:11 -0400 Subject: [PATCH] When cloning canvas (in toDataURL, for example) make sure to clone `clipTo` (clipping function) property as well. --- demos/index.html | 6 +++--- dist/all.js | 3 ++- fabric.js | 2 +- src/element.class.js | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/demos/index.html b/demos/index.html index 98c13529..c6b70aa8 100644 --- a/demos/index.html +++ b/demos/index.html @@ -2,7 +2,7 @@ - Demos + Fabric.js demos @@ -13,8 +13,8 @@
diff --git a/dist/all.js b/dist/all.js index 07328687..eb66cad5 100644 --- a/dist/all.js +++ b/dist/all.js @@ -6011,7 +6011,8 @@ fabric.util.animate = animate; el.height = this.getHeight(); var clone = this.__clone || (this.__clone = new fabric.Element(el)); - + clone.clipTo = this.clipTo; + return clone.loadFromJSON(JSON.stringify(this.toJSON()), function () { if (callback) { callback(clone); diff --git a/fabric.js b/fabric.js index 89043409..f626b536 100644 --- a/fabric.js +++ b/fabric.js @@ -1,6 +1,6 @@ /*! Fabric.js Copyright 2008-2011, Bitsonnet (Juriy Zaytsev, Maxim Chernyak) */ -var fabric = fabric || { version: "0.2.6" }; +var fabric = fabric || { version: "0.2.7" }; /** * Wrapper around `console.log` (when available) diff --git a/src/element.class.js b/src/element.class.js index 6f5bd07a..3680ff44 100644 --- a/src/element.class.js +++ b/src/element.class.js @@ -2217,6 +2217,7 @@ // cache var clone = this.__clone || (this.__clone = new fabric.Element(el)); + clone.clipTo = this.clipTo; return clone.loadFromJSON(JSON.stringify(this.toJSON()), function () { if (callback) {