aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/html-document.js89
1 files changed, 36 insertions, 53 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js
index b9944d66..aa56fd0e 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -188,66 +188,49 @@ exports.HTMLDocument = Montage.create(TextDocument, {
188// }, 188// },
189 189
190 glData: { 190 glData: {
191 get: function() 191 get: function() {
192 { 192 //
193 var elt = this.iframe.contentWindow.document.getElementById("UserContent"); 193 var elt = this.iframe.contentWindow.document.getElementById("UserContent");
194 this._glData = null; 194 //
195 if (elt) 195 if (elt) {
196 {
197 this._glData = []; 196 this._glData = [];
198 var path = "assets/"; 197 //if (path) {
199 this.collectGLData( elt, this._glData, path ); 198 //this.collectGLData(elt, this._glData, path);
199 //} else {
200 this.collectGLData(elt, this._glData, "assets/");
201 //}
202 } else {
203 this._glData = null
200 } 204 }
201 205 //
202 return this._glData; 206 return this._glData;
203 }, 207 },
204 208 set: function(value) {
205 set: function(value)
206 {
207 var elt = this.documentRoot; 209 var elt = this.documentRoot;
208 if (elt) 210 if (elt) {
209 { 211 var nWorlds= value.length;
210// var loadForRuntime = false; 212 for (var i=0; i<nWorlds; i++) {
211// if (loadForRuntime) 213 var importStr = value[i];
212// { 214 var startIndex = importStr.indexOf( "id: " );
213// var cdm = new CanvasDataManager(); 215 if (startIndex >= 0) {
214// cdm.loadGLData(elt, value ); 216 var endIndex = importStr.indexOf( "\n", startIndex );
215// } 217 if (endIndex > 0) {
216// else 218 var id = importStr.substring( startIndex+4, endIndex );
217 { 219 if (id) {
218 var nWorlds= value.length; 220 var canvas = this.findCanvasWithID( id, elt );
219 for (var i=0; i<nWorlds; i++) 221 if (canvas) {
220 { 222 if (!canvas.elementModel) {
221 var importStr = value[i]; 223 NJUtils.makeElementModel(canvas, "Canvas", "shape", true);
222 var startIndex = importStr.indexOf( "id: " ); 224 }
223 if (startIndex >= 0) 225 if (canvas.elementModel) {
224 { 226 if (canvas.elementModel.shapeModel.GLWorld) {
225 var endIndex = importStr.indexOf( "\n", startIndex ); 227 canvas.elementModel.shapeModel.GLWorld.clearTree();
226 if (endIndex > 0)
227 {
228 var id = importStr.substring( startIndex+4, endIndex );
229 if (id)
230 {
231 var canvas = this.findCanvasWithID( id, elt );
232 if (canvas)
233 {
234 if (!canvas.elementModel)
235 {
236 NJUtils.makeElementModel(canvas, "Canvas", "shape", true);
237 }
238
239 if (canvas.elementModel)
240 {
241 if (canvas.elementModel.shapeModel.GLWorld)
242 canvas.elementModel.shapeModel.GLWorld.clearTree();
243
244 var index = importStr.indexOf( "webGL: " );
245 var useWebGL = (index >= 0)
246 var world = new GLWorld( canvas, useWebGL );
247 world.import( importStr );
248
249 this.buildShapeModel( canvas.elementModel, world );
250 } 228 }
229 var index = importStr.indexOf( "webGL: " );
230 var useWebGL = (index >= 0)
231 var world = new GLWorld( canvas, useWebGL );
232 world.import( importStr );
233 this.buildShapeModel( canvas.elementModel, world );
251 } 234 }
252 } 235 }
253 } 236 }