diff options
author | Jose Antonio Marquez Russo | 2012-02-23 15:28:23 -0800 |
---|---|---|
committer | Jose Antonio Marquez Russo | 2012-02-23 15:28:23 -0800 |
commit | 9a757cbbb19bba27a86060fd2d550a81f5ec71b4 (patch) | |
tree | f18c1eed05e296a1a5b7cbf57ebd2499f11529d8 /js/document/html-document.js | |
parent | ad7ae032bc55198e16a02dc75aa15303c033ea58 (diff) | |
parent | 26bb2894c29d4608e843de01829d352dd3d00823 (diff) | |
download | ninja-9a757cbbb19bba27a86060fd2d550a81f5ec71b4.tar.gz |
Merge pull request #17 from ericmueller/integration
Integration
Diffstat (limited to 'js/document/html-document.js')
-rwxr-xr-x | js/document/html-document.js | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js index eaf56146..6394e3ce 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js | |||
@@ -153,13 +153,13 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
153 | glData: { | 153 | glData: { |
154 | get: function() | 154 | get: function() |
155 | { | 155 | { |
156 | var elt = this.iframe; | ||
157 | var elt = this.iframe.contentWindow.document.getElementById("UserContent"); | 156 | var elt = this.iframe.contentWindow.document.getElementById("UserContent"); |
158 | this._glData = null; | 157 | this._glData = null; |
159 | if (elt) | 158 | if (elt) |
160 | { | 159 | { |
161 | this._glData = new Array(); | 160 | var cdm = new CanvasDataManager(); |
162 | this.collectGLData( elt, this._glData ); | 161 | this._glData = []; |
162 | cdm.collectGLData( elt, this._glData ); | ||
163 | } | 163 | } |
164 | 164 | ||
165 | return this._glData | 165 | return this._glData |
@@ -167,37 +167,12 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
167 | 167 | ||
168 | set: function(value) | 168 | set: function(value) |
169 | { | 169 | { |
170 | var nWorlds = value.length; | 170 | var elt = this.iframe.contentWindow.document.getElementById("UserContent"); |
171 | for (var i=0; i<nWorlds; i++) | 171 | if (elt) |
172 | { | 172 | { |
173 | var importStr = value[i]; | 173 | console.log( "load canvas data: " + value ); |
174 | var startIndex = importStr.indexOf( "id: " ); | 174 | var cdm = new CanvasDataManager(); |
175 | if (startIndex >= 0) | 175 | cdm.loadGLData(elt, value); |
176 | { | ||
177 | var endIndex = importStr.indexOf( "\n", startIndex ); | ||
178 | if (endIndex > 0) | ||
179 | { | ||
180 | var id = importStr.substring( startIndex+4, endIndex ); | ||
181 | var canvas = this.iframe.contentWindow.document.getElementById( id ); | ||
182 | if (canvas) | ||
183 | { | ||
184 | if (!canvas.elementModel) | ||
185 | { | ||
186 | NJUtils.makeElementModel(canvas, "Canvas", "shape", true); | ||
187 | } | ||
188 | |||
189 | if (canvas.elementModel) | ||
190 | { | ||
191 | if (canvas.elementModel.shapeModel.GLWorld) | ||
192 | canvas.elementModel.shapeModel.GLWorld.clearTree(); | ||
193 | |||
194 | var world = new GLWorld( canvas ); | ||
195 | canvas.elementModel.shapeModel.GLWorld = world; | ||
196 | world.import( importStr ); | ||
197 | } | ||
198 | } | ||
199 | } | ||
200 | } | ||
201 | } | 176 | } |
202 | } | 177 | } |
203 | }, | 178 | }, |