aboutsummaryrefslogtreecommitdiff
path: root/js/document/html-document.js
diff options
context:
space:
mode:
authorAnanya Sen2012-02-23 17:57:06 -0800
committerAnanya Sen2012-02-23 17:57:06 -0800
commita23455a887982d306d794b6afca497259cfa7f4a (patch)
tree7396eb7b5e0759035f666a7eee9d325979887d4a /js/document/html-document.js
parent6e66f411ba02eaaeb33471115345ecf3c7ce4ce9 (diff)
parent97d6314f96f309332a655d49b95ec651c378bcf2 (diff)
downloadninja-a23455a887982d306d794b6afca497259cfa7f4a.tar.gz
Merge branch 'refs/heads/FileIO-jose' into FileIO
Diffstat (limited to 'js/document/html-document.js')
-rwxr-xr-xjs/document/html-document.js41
1 files changed, 8 insertions, 33 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js
index c5293386..8798b407 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -168,13 +168,13 @@ exports.HTMLDocument = Montage.create(TextDocument, {
168 glData: { 168 glData: {
169 get: function() 169 get: function()
170 { 170 {
171 var elt = this.iframe;
172 var elt = this.iframe.contentWindow.document.getElementById("UserContent"); 171 var elt = this.iframe.contentWindow.document.getElementById("UserContent");
173 this._glData = null; 172 this._glData = null;
174 if (elt) 173 if (elt)
175 { 174 {
176 this._glData = new Array(); 175 var cdm = new CanvasDataManager();
177 this.collectGLData( elt, this._glData ); 176 this._glData = [];
177 cdm.collectGLData( elt, this._glData );
178 } 178 }
179 179
180 return this._glData 180 return this._glData
@@ -182,37 +182,12 @@ exports.HTMLDocument = Montage.create(TextDocument, {
182 182
183 set: function(value) 183 set: function(value)
184 { 184 {
185 var nWorlds = value.length; 185 var elt = this.iframe.contentWindow.document.getElementById("UserContent");
186 for (var i=0; i<nWorlds; i++) 186 if (elt)
187 { 187 {
188 var importStr = value[i]; 188 console.log( "load canvas data: " + value );
189 var startIndex = importStr.indexOf( "id: " ); 189 var cdm = new CanvasDataManager();
190 if (startIndex >= 0) 190 cdm.loadGLData(elt, value);
191 {
192 var endIndex = importStr.indexOf( "\n", startIndex );
193 if (endIndex > 0)
194 {
195 var id = importStr.substring( startIndex+4, endIndex );
196 var canvas = this.iframe.contentWindow.document.getElementById( id );
197 if (canvas)
198 {
199 if (!canvas.elementModel)
200 {
201 NJUtils.makeElementModel(canvas, "Canvas", "shape", true);
202 }
203
204 if (canvas.elementModel)
205 {
206 if (canvas.elementModel.shapeModel.GLWorld)
207 canvas.elementModel.shapeModel.GLWorld.clearTree();
208
209 var world = new GLWorld( canvas );
210 canvas.elementModel.shapeModel.GLWorld = world;
211 world.import( importStr );
212 }
213 }
214 }
215 }
216 } 191 }
217 } 192 }
218 }, 193 },