aboutsummaryrefslogtreecommitdiff
path: root/js/lib/drawing/world.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/drawing/world.js')
-rwxr-xr-xjs/lib/drawing/world.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js
index 1a391338..0dde9af4 100755
--- a/js/lib/drawing/world.js
+++ b/js/lib/drawing/world.js
@@ -362,9 +362,9 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) {
362 362
363 // start RDGE passing your runtime object, and false to indicate we don't need a an initialization state 363 // start RDGE passing your runtime object, and false to indicate we don't need a an initialization state
364 // in the case of a procedurally built scene an init state is not needed for loading data 364 // in the case of a procedurally built scene an init state is not needed for loading data
365 this._canvas.rdgeid = this._canvas.getAttribute( "data-RDGE-id" );
365 if (this._useWebGL) { 366 if (this._useWebGL) {
366 rdgeStarted = true; 367 rdgeStarted = true;
367 this._canvas.rdgeid = this._canvas.getAttribute( "data-RDGE-id" );
368 RDGE.globals.engine.unregisterCanvas( this._canvas ); 368 RDGE.globals.engine.unregisterCanvas( this._canvas );
369 RDGE.globals.engine.registerCanvas(this._canvas, this); 369 RDGE.globals.engine.registerCanvas(this._canvas, this);
370 RDGE.RDGEStart( this._canvas ); 370 RDGE.RDGEStart( this._canvas );
@@ -758,7 +758,7 @@ World.prototype.exportJSON = function () {
758 // would not be destructive of the data. You would be wrong... 758 // would not be destructive of the data. You would be wrong...
759 // We need to rebuild everything 759 // We need to rebuild everything
760 if (this._useWebGL) { 760 if (this._useWebGL) {
761 if (worldObj.children && (worldObj.children.length === 1)) { 761 if (worldObj.children && (worldObj.children.length >= 1)) {
762 this.rebuildTree(this._geomRoot); 762 this.rebuildTree(this._geomRoot);
763 this.restartRenderLoop(); 763 this.restartRenderLoop();
764 } 764 }
@@ -835,8 +835,11 @@ World.prototype.importJSON = function (jObj) {
835 835
836 // import the objects 836 // import the objects
837 // there should be exactly one child of the parent object 837 // there should be exactly one child of the parent object
838 if (jObj.children && (jObj.children.length === 1)) 838 if (jObj.children)
839 this.importObjectsJSON( jObj.children[0] ); 839 {
840 for (var i=0; i<jObj.children.length; i++)
841 this.importObjectsJSON( jObj.children[i] );
842 }
840 else 843 else
841 throw new Error ("unrecoverable canvas import error - inconsistent root object: " + jObj.children ); 844 throw new Error ("unrecoverable canvas import error - inconsistent root object: " + jObj.children );
842 845
@@ -871,17 +874,17 @@ World.prototype.importObjectJSON = function( jObj, parentGeomObj )
871 switch (type) 874 switch (type)
872 { 875 {
873 case 1: 876 case 1:
874 obj = new Rectangle(); 877 obj = Object.create(Rectangle, {});
875 obj.importJSON( jObj ); 878 obj.importJSON( jObj );
876 break; 879 break;
877 880
878 case 2: // circle 881 case 2: // circle
879 obj = new Circle(); 882 obj = Object.create(Circle, {});
880 obj.importJSON( jObj ); 883 obj.importJSON( jObj );
881 break; 884 break;
882 885
883 case 3: // line 886 case 3: // line
884 obj = new Line(); 887 obj = Object.create(Line, {});
885 obj.importJSON( jObj ); 888 obj.importJSON( jObj );
886 break; 889 break;
887 890