changeset 1436:a9e96291ef0b

Clone the javascrip properties of the object return by clone_from_subtree. This should be relocated to the javascript version of the clone_from_subtree in the future.
author wycc
date Mon, 11 Apr 2011 13:00:11 +0800
parents b12c513212af
children 7f4edd6e175e
files nodejs/mbapp.js
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/nodejs/mbapp.js	Mon Apr 11 12:54:39 2011 +0800
+++ b/nodejs/mbapp.js	Mon Apr 11 13:00:11 2011 +0800
@@ -207,11 +207,23 @@
         var dup = this.mb_rt.coord_new(src.parent);
 	for (i in nodes) {
 	    var c = nodes[i];
-	    var ng = this.mb_rt.coord_new(dup);
 	    var k = dup.clone_from_subtree(c);
 	    c.dup = k;
 	    c.dup.id = c.id;
 	    c.dup.refid = c.refid;
+	    // The following code should be relocated to the javascript wrapper 
+	    // the clone_from_subtree in the future.
+	    try {
+		k.bbox = c.bbox;
+		k.bbox.owner = k;
+	    } catch(e) {
+	    }
+
+	    try {
+		k.center = c.center;
+		k.center.owner = c.owner;
+	    } catch(e) {
+	    }
 	}
 	src.dup = dup;
     } else {