diff options
Diffstat (limited to 'js/document/html-document.js')
-rwxr-xr-x | js/document/html-document.js | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js index d4db6e2f..bf03e38b 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js | |||
@@ -194,11 +194,7 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
194 | // | 194 | // |
195 | if (elt) { | 195 | if (elt) { |
196 | this._glData = []; | 196 | this._glData = []; |
197 | //if (path) { | 197 | this.collectGLData(elt, this._glData ); |
198 | //this.collectGLData(elt, this._glData, path); | ||
199 | //} else { | ||
200 | this.collectGLData(elt, this._glData ); | ||
201 | //} | ||
202 | } else { | 198 | } else { |
203 | this._glData = null | 199 | this._glData = null |
204 | } | 200 | } |
@@ -220,25 +216,26 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
220 | 216 | ||
221 | // /* | 217 | // /* |
222 | var importStr = value[i]; | 218 | var importStr = value[i]; |
223 | var startIndex = importStr.indexOf( "id: " ); | 219 | var jObj = JSON.parse( importStr ); |
224 | if (startIndex >= 0) { | 220 | if (jObj) |
225 | var endIndex = importStr.indexOf( "\n", startIndex ); | 221 | { |
226 | if (endIndex > 0) { | 222 | var id = jObj.id; |
227 | var id = importStr.substring( startIndex+4, endIndex ); | 223 | if (id) |
228 | if (id) { | 224 | { |
229 | var canvas = this.findCanvasWithID( id, elt ); | 225 | var canvas = this.findCanvasWithID( id, elt ); |
230 | if (canvas) { | 226 | if (canvas) { |
231 | if (!canvas.elementModel) { | 227 | if (!canvas.elementModel) { |
232 | NJUtils.makeElementModel(canvas, "Canvas", "shape", true); | 228 | NJUtils.makeElementModel(canvas, "Canvas", "shape", true); |
229 | } | ||
230 | if (canvas.elementModel) { | ||
231 | if (canvas.elementModel.shapeModel.GLWorld) { | ||
232 | canvas.elementModel.shapeModel.GLWorld.clearTree(); | ||
233 | } | 233 | } |
234 | if (canvas.elementModel) { | 234 | if (jObj) |
235 | if (canvas.elementModel.shapeModel.GLWorld) { | 235 | { |
236 | canvas.elementModel.shapeModel.GLWorld.clearTree(); | 236 | var useWebGL = jObj.webGL; |
237 | } | ||
238 | var index = importStr.indexOf( "webGL: " ); | ||
239 | var useWebGL = (index >= 0) | ||
240 | var world = new GLWorld( canvas, useWebGL ); | 237 | var world = new GLWorld( canvas, useWebGL ); |
241 | world.import( importStr ); | 238 | world.importJSON( jObj ); |
242 | this.buildShapeModel( canvas.elementModel, world ); | 239 | this.buildShapeModel( canvas.elementModel, world ); |
243 | } | 240 | } |
244 | } | 241 | } |
@@ -382,7 +379,7 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
382 | { | 379 | { |
383 | if (elt.elementModel && elt.elementModel.shapeModel && elt.elementModel.shapeModel.GLWorld) | 380 | if (elt.elementModel && elt.elementModel.shapeModel && elt.elementModel.shapeModel.GLWorld) |
384 | { | 381 | { |
385 | var data = elt.elementModel.shapeModel.GLWorld.export(); | 382 | var data = elt.elementModel.shapeModel.GLWorld.exportJSON(); |
386 | dataArray.push( data ); | 383 | dataArray.push( data ); |
387 | } | 384 | } |
388 | 385 | ||