Commit 8fa2f326 by Tomas Alabes

Merge pull request #667 from tomasAlabes/master

Clone and set construction fix
parents 2c36cf67 124b0646
...@@ -425,6 +425,10 @@ ...@@ -425,6 +425,10 @@
text: function (el) { text: function (el) {
var bbox = el._getBBox(); var bbox = el._getBBox();
return rectPath(bbox.x, bbox.y, bbox.width, bbox.height); return rectPath(bbox.x, bbox.y, bbox.width, bbox.height);
},
set : function(el) {
var bbox = el._getBBox();
return rectPath(bbox.x, bbox.y, bbox.width, bbox.height);
} }
}, },
...@@ -1297,7 +1301,7 @@ ...@@ -1297,7 +1301,7 @@
var pathDimensions = R.pathBBox = function (path) { var pathDimensions = R.pathBBox = function (path) {
var pth = paths(path); var pth = paths(path);
if (pth.bbox) { if (pth.bbox) {
return pth.bbox; return clone(pth.bbox);
} }
if (!path) { if (!path) {
return {x: 0, y: 0, width: 0, height: 0, x2: 0, y2: 0}; return {x: 0, y: 0, width: 0, height: 0, x2: 0, y2: 0};
...@@ -2504,6 +2508,8 @@ ...@@ -2504,6 +2508,8 @@
!R.is(itemsArray, "array") && (itemsArray = Array.prototype.splice.call(arguments, 0, arguments.length)); !R.is(itemsArray, "array") && (itemsArray = Array.prototype.splice.call(arguments, 0, arguments.length));
var out = new Set(itemsArray); var out = new Set(itemsArray);
this.__set__ && this.__set__.push(out); this.__set__ && this.__set__.push(out);
out["paper"] = this;
out["type"] = "set";
return out; return out;
}; };
...@@ -3547,7 +3553,7 @@ ...@@ -3547,7 +3553,7 @@
}; };
}; };
setproto.clone = function (s) { setproto.clone = function (s) {
s = new Set; s = this.paper.set();
for (var i = 0, ii = this.items.length; i < ii; i++) { for (var i = 0, ii = this.items.length; i < ii; i++) {
s.push(this.items[i].clone()); s.push(this.items[i].clone());
} }
...@@ -3557,7 +3563,7 @@ ...@@ -3557,7 +3563,7 @@
return "Rapha\xebl\u2018s set"; return "Rapha\xebl\u2018s set";
}; };
R.registerFont = function (font) { R.registerFont = function (font) {
if (!font.face) { if (!font.face) {
return font; return font;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment