aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/html-document.js48
1 files changed, 26 insertions, 22 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 0dc26884..051490f5 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -9,7 +9,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
9var Montage = require("montage/core/core").Montage, 9var Montage = require("montage/core/core").Montage,
10 TextDocument = require("js/document/text-document").TextDocument, 10 TextDocument = require("js/document/text-document").TextDocument,
11 NJUtils = require("js/lib/NJUtils").NJUtils, 11 NJUtils = require("js/lib/NJUtils").NJUtils,
12 CanvasDataManager = require("js/lib/rdge/runtime/CanvasDataManager").CanvasDataManager,
13 GLWorld = require("js/lib/drawing/world").World; 12 GLWorld = require("js/lib/drawing/world").World;
14//////////////////////////////////////////////////////////////////////// 13////////////////////////////////////////////////////////////////////////
15// 14//
@@ -189,35 +188,36 @@ exports.HTMLDocument = Montage.create(TextDocument, {
189// }, 188// },
190 189
191 glData: { 190 glData: {
192 get: function() 191 get: function() {
193 { 192 //
194 var elt = this.iframe.contentWindow.document.getElementById("UserContent"); 193 var elt = this.iframe.contentWindow.document.getElementById("UserContent");
195 this._glData = null; 194 //
196 if (elt) 195 if (elt) {
197 {
198 var cdm = new CanvasDataManager();
199 this._glData = []; 196 this._glData = [];
200 cdm.collectGLData( elt, this._glData ); 197 //if (path) {
198 //this.collectGLData(elt, this._glData, path);
199 //} else {
200 this.collectGLData(elt, this._glData );
201 //}
202 } else {
203 this._glData = null
201 } 204 }
202 205 //
203 return this._glData; 206 return this._glData;
204 }, 207 },
205 208 set: function(value) {
206 set: function(value)
207 {
208 var elt = this.documentRoot; 209 var elt = this.documentRoot;
209 if (elt) 210 if (elt) {
210 {
211 var nWorlds= value.length; 211 var nWorlds= value.length;
212 for (var i=0; i<nWorlds; i++) { 212 for (var i=0; i<nWorlds; i++) {
213 var importStr = value[i]; 213 var importStr = value[i];
214 var startIndex = importStr.indexOf("id: "); 214 var startIndex = importStr.indexOf( "id: " );
215 if (startIndex >= 0) { 215 if (startIndex >= 0) {
216 var endIndex = importStr.indexOf("\n", startIndex); 216 var endIndex = importStr.indexOf( "\n", startIndex );
217 if (endIndex > 0) { 217 if (endIndex > 0) {
218 var id = importStr.substring( startIndex+4, endIndex); 218 var id = importStr.substring( startIndex+4, endIndex );
219 if (id) { 219 if (id) {
220 var canvas = this.findCanvasWithID(id, elt); 220 var canvas = this.findCanvasWithID( id, elt );
221 if (canvas) { 221 if (canvas) {
222 if (!canvas.elementModel) { 222 if (!canvas.elementModel) {
223 NJUtils.makeElementModel(canvas, "Canvas", "shape", true); 223 NJUtils.makeElementModel(canvas, "Canvas", "shape", true);
@@ -228,9 +228,9 @@ exports.HTMLDocument = Montage.create(TextDocument, {
228 } 228 }
229 var index = importStr.indexOf( "webGL: " ); 229 var index = importStr.indexOf( "webGL: " );
230 var useWebGL = (index >= 0) 230 var useWebGL = (index >= 0)
231 var world = new GLWorld(canvas, useWebGL); 231 var world = new GLWorld( canvas, useWebGL );
232 world.import( importStr ); 232 world.import( importStr );
233 this.buildShapeModel(canvas.elementModel, world); 233 this.buildShapeModel( canvas.elementModel, world );
234 } 234 }
235 } 235 }
236 } 236 }
@@ -871,8 +871,12 @@ exports.HTMLDocument = Montage.create(TextDocument, {
871 value: function () { 871 value: function () {
872 //TODO: Add logic to handle save before preview 872 //TODO: Add logic to handle save before preview
873 this.application.ninja.documentController.handleExecuteSaveAll(null); 873 this.application.ninja.documentController.handleExecuteSaveAll(null);
874 //Launching 'blank' tab for testing movie 874 //Temp check for webGL Hack
875 window.open(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]); 875 if (this.application.ninja.documentController.activeDocument.glData.length && this.application.ninja.documentController.activeDocument.glData.length > 0) {
876 setTimeout(function () {window.open(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]);}.bind(this), 3500);
877 } else {
878 window.open(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]);
879 }
876 //chrome.tabs.create({url: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]}); 880 //chrome.tabs.create({url: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]});
877 } 881 }
878 }, 882 },