From 64280907f31e6f6e5659acb0893df3e0da5bb044 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 22 Feb 2012 16:28:29 -0800 Subject: GL save and reload. --- js/document/html-document.js | 41 ++++++++--------------------------------- 1 file changed, 8 insertions(+), 33 deletions(-) (limited to 'js/document') diff --git a/js/document/html-document.js b/js/document/html-document.js index 9a7755e6..f5816f64 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -152,13 +152,13 @@ exports.HTMLDocument = Montage.create(TextDocument, { glData: { get: function() { - var elt = this.iframe; var elt = this.iframe.contentWindow.document.getElementById("UserContent"); this._glData = null; if (elt) { - this._glData = new Array(); - this.collectGLData( elt, this._glData ); + var cdm = new CanvasDataManager(); + this._glData = []; + cdm.collectGLData( elt, this._glData ); } return this._glData @@ -166,37 +166,12 @@ exports.HTMLDocument = Montage.create(TextDocument, { set: function(value) { - var nWorlds = value.length; - for (var i=0; i= 0) - { - var endIndex = importStr.indexOf( "\n", startIndex ); - if (endIndex > 0) - { - var id = importStr.substring( startIndex+4, endIndex ); - var canvas = this.iframe.contentWindow.document.getElementById( id ); - if (canvas) - { - if (!canvas.elementModel) - { - NJUtils.makeElementModel(canvas, "Canvas", "shape", true); - } - - if (canvas.elementModel) - { - if (canvas.elementModel.shapeModel.GLWorld) - canvas.elementModel.shapeModel.GLWorld.clearTree(); - - var world = new GLWorld( canvas ); - canvas.elementModel.shapeModel.GLWorld = world; - world.import( importStr ); - } - } - } - } + console.log( "load canvas data: " + value ); + var cdm = new CanvasDataManager(); + cdm.loadGLData(elt, value); } } }, -- cgit v1.2.3