From 7b6e8194b91168abdeb94702eb350d14f147858b Mon Sep 17 00:00:00 2001 From: hwc487 Date: Thu, 8 Mar 2012 17:29:18 -0800 Subject: Canvas IO --- js/document/html-document.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'js/document') diff --git a/js/document/html-document.js b/js/document/html-document.js index 078a73b5..b2113623 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 var Montage = require("montage/core/core").Montage, TextDocument = require("js/document/text-document").TextDocument, NJUtils = require("js/lib/NJUtils").NJUtils, - CanvasDataManager = require("js/lib/rdge/runtime/CanvasDataManager").CanvasDataManager, GLWorld = require("js/lib/drawing/world").World; //////////////////////////////////////////////////////////////////////// // @@ -174,9 +173,9 @@ exports.HTMLDocument = Montage.create(TextDocument, { this._glData = null; if (elt) { - var cdm = new CanvasDataManager(); this._glData = []; - cdm.collectGLData( elt, this._glData ); + var path = "assets/"; + this.collectGLData( elt, this._glData, path ); } return this._glData; @@ -187,9 +186,7 @@ exports.HTMLDocument = Montage.create(TextDocument, { var elt = this.documentRoot; if (elt) { -// FOR JOSE: The following commented out lines are what the runtime -// version should execute. -// var loadForRuntime = true; +// var loadForRuntime = false; // if (loadForRuntime) // { // var cdm = new CanvasDataManager(); @@ -367,11 +364,11 @@ exports.HTMLDocument = Montage.create(TextDocument, { collectGLData: { - value: function( elt, dataArray ) + value: function( elt, dataArray, imagePath ) { if (elt.elementModel && elt.elementModel.shapeModel && elt.elementModel.shapeModel.GLWorld) { - var data = elt.elementModel.shapeModel.GLWorld.export(); + var data = elt.elementModel.shapeModel.GLWorld.export( imagePath ); dataArray.push( data ); } @@ -381,7 +378,7 @@ exports.HTMLDocument = Montage.create(TextDocument, { for (var i=0; i= 0) - { - var endIndex = importStr.indexOf( "\n", startIndex ); - if (endIndex > 0) - { - var id = importStr.substring( startIndex+4, endIndex ); - if (id) - { - var canvas = this.findCanvasWithID( id, elt ); - 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 index = importStr.indexOf( "webGL: " ); - var useWebGL = (index >= 0) - var world = new GLWorld( canvas, useWebGL ); - world.import( importStr ); - - this.buildShapeModel( canvas.elementModel, world ); + if (elt) { + 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 ); + if (id) { + var canvas = this.findCanvasWithID( id, elt ); + 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 index = importStr.indexOf( "webGL: " ); + var useWebGL = (index >= 0) + var world = new GLWorld( canvas, useWebGL ); + world.import( importStr ); + this.buildShapeModel( canvas.elementModel, world ); } } } -- cgit v1.2.3 From e92a6da7b84c58803489d70efedf74837ddfe4cd Mon Sep 17 00:00:00 2001 From: hwc487 Date: Fri, 9 Mar 2012 13:34:09 -0800 Subject: Removed asset path replacement at authortime. --- js/document/html-document.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'js/document') diff --git a/js/document/html-document.js b/js/document/html-document.js index aa56fd0e..f57c61ee 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -197,7 +197,7 @@ exports.HTMLDocument = Montage.create(TextDocument, { //if (path) { //this.collectGLData(elt, this._glData, path); //} else { - this.collectGLData(elt, this._glData, "assets/"); + this.collectGLData(elt, this._glData ); //} } else { this._glData = null @@ -368,11 +368,11 @@ exports.HTMLDocument = Montage.create(TextDocument, { collectGLData: { - value: function( elt, dataArray, imagePath ) + value: function( elt, dataArray ) { if (elt.elementModel && elt.elementModel.shapeModel && elt.elementModel.shapeModel.GLWorld) { - var data = elt.elementModel.shapeModel.GLWorld.export( imagePath ); + var data = elt.elementModel.shapeModel.GLWorld.export(); dataArray.push( data ); } -- cgit v1.2.3 From a5d4d57a3575bb3b97fe692ddffca3127463ae94 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Fri, 9 Mar 2012 14:27:23 -0800 Subject: further removal of authortime asset path replacement. --- js/document/html-document.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/document') diff --git a/js/document/html-document.js b/js/document/html-document.js index f57c61ee..79450494 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -382,7 +382,7 @@ exports.HTMLDocument = Montage.create(TextDocument, { for (var i=0; i 0) { + 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); + } else { + window.open(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]); + } //chrome.tabs.create({url: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]}); } }, -- cgit v1.2.3