diff options
Diffstat (limited to 'js')
37 files changed, 1202 insertions, 570 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 6f7d098f..e221df68 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -86,8 +86,12 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
86 | // | 86 | // |
87 | handleAppLoaded: { | 87 | handleAppLoaded: { |
88 | value: function() { | 88 | value: function() { |
89 | //Checking for app not to be loaded via http/https to add app only listener | 89 | //Checking for app to be loaded through extension |
90 | if (window.location.protocol !== 'http:' && window.location.protocol !== 'https:') { | 90 | var check; |
91 | if (chrome && chrome.app) { | ||
92 | check = chrome.app.getDetails(); | ||
93 | } | ||
94 | if (check !== null) { | ||
91 | //Adding an intercept to resources loaded to ensure user assets load from cloud simulator | 95 | //Adding an intercept to resources loaded to ensure user assets load from cloud simulator |
92 | chrome.webRequest.onBeforeRequest.addListener(this.handleWebRequest.bind(this), {urls: ["<all_urls>"]}, ["blocking"]); | 96 | chrome.webRequest.onBeforeRequest.addListener(this.handleWebRequest.bind(this), {urls: ["<all_urls>"]}, ["blocking"]); |
93 | } | 97 | } |
diff --git a/js/document/html-document.js b/js/document/html-document.js index c5293386..8798b407 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js | |||
@@ -168,13 +168,13 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
168 | glData: { | 168 | glData: { |
169 | get: function() | 169 | get: function() |
170 | { | 170 | { |
171 | var elt = this.iframe; | ||
172 | var elt = this.iframe.contentWindow.document.getElementById("UserContent"); | 171 | var elt = this.iframe.contentWindow.document.getElementById("UserContent"); |
173 | this._glData = null; | 172 | this._glData = null; |
174 | if (elt) | 173 | if (elt) |
175 | { | 174 | { |
176 | this._glData = new Array(); | 175 | var cdm = new CanvasDataManager(); |
177 | this.collectGLData( elt, this._glData ); | 176 | this._glData = []; |
177 | cdm.collectGLData( elt, this._glData ); | ||
178 | } | 178 | } |
179 | 179 | ||
180 | return this._glData | 180 | return this._glData |
@@ -182,37 +182,12 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
182 | 182 | ||
183 | set: function(value) | 183 | set: function(value) |
184 | { | 184 | { |
185 | var nWorlds = value.length; | 185 | var elt = this.iframe.contentWindow.document.getElementById("UserContent"); |
186 | for (var i=0; i<nWorlds; i++) | 186 | if (elt) |
187 | { | 187 | { |
188 | var importStr = value[i]; | 188 | console.log( "load canvas data: " + value ); |
189 | var startIndex = importStr.indexOf( "id: " ); | 189 | var cdm = new CanvasDataManager(); |
190 | if (startIndex >= 0) | 190 | cdm.loadGLData(elt, value); |
191 | { | ||
192 | var endIndex = importStr.indexOf( "\n", startIndex ); | ||
193 | if (endIndex > 0) | ||
194 | { | ||
195 | var id = importStr.substring( startIndex+4, endIndex ); | ||
196 | var canvas = this.iframe.contentWindow.document.getElementById( id ); | ||
197 | if (canvas) | ||
198 | { | ||
199 | if (!canvas.elementModel) | ||
200 | { | ||
201 | NJUtils.makeElementModel(canvas, "Canvas", "shape", true); | ||
202 | } | ||
203 | |||
204 | if (canvas.elementModel) | ||
205 | { | ||
206 | if (canvas.elementModel.shapeModel.GLWorld) | ||
207 | canvas.elementModel.shapeModel.GLWorld.clearTree(); | ||
208 | |||
209 | var world = new GLWorld( canvas ); | ||
210 | canvas.elementModel.shapeModel.GLWorld = world; | ||
211 | world.import( importStr ); | ||
212 | } | ||
213 | } | ||
214 | } | ||
215 | } | ||
216 | } | 191 | } |
217 | } | 192 | } |
218 | }, | 193 | }, |
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index a2fac34f..bedda8bf 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js | |||
@@ -1226,6 +1226,14 @@ exports.ViewUtils = Montage.create(Component, { | |||
1226 | } | 1226 | } |
1227 | }, | 1227 | }, |
1228 | 1228 | ||
1229 | getCurrentDocument: | ||
1230 | { | ||
1231 | value: function() | ||
1232 | { | ||
1233 | return snapManagerModule.SnapManager.application.ninja.currentDocument; | ||
1234 | } | ||
1235 | }, | ||
1236 | |||
1229 | setStageZoom: { | 1237 | setStageZoom: { |
1230 | value:function( globalPt, zoomFactor ) { | 1238 | value:function( globalPt, zoomFactor ) { |
1231 | var localPt; | 1239 | var localPt; |
diff --git a/js/helper-classes/RDGE/GLCircle.js b/js/helper-classes/RDGE/GLCircle.js index 5b32547e..712544c0 100755 --- a/js/helper-classes/RDGE/GLCircle.js +++ b/js/helper-classes/RDGE/GLCircle.js | |||
@@ -135,7 +135,7 @@ function GLCircle() | |||
135 | if (!world._useWebGL) return; | 135 | if (!world._useWebGL) return; |
136 | 136 | ||
137 | // make sure RDGE has the correct context | 137 | // make sure RDGE has the correct context |
138 | g_Engine.setContext( world.getCanvas().uuid ); | 138 | g_Engine.setContext( world.getCanvas().rdgeid ); |
139 | 139 | ||
140 | // create the gl buffer | 140 | // create the gl buffer |
141 | var gl = world.getGLContext(); | 141 | var gl = world.getGLContext(); |
diff --git a/js/helper-classes/RDGE/GLLine.js b/js/helper-classes/RDGE/GLLine.js index 0d815145..f715a43c 100755 --- a/js/helper-classes/RDGE/GLLine.js +++ b/js/helper-classes/RDGE/GLLine.js | |||
@@ -171,7 +171,7 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro | |||
171 | if (!world._useWebGL) return; | 171 | if (!world._useWebGL) return; |
172 | 172 | ||
173 | // make sure RDGE has the correct context | 173 | // make sure RDGE has the correct context |
174 | g_Engine.setContext( world.getCanvas().uuid ); | 174 | g_Engine.setContext( world.getCanvas().rdgeid ); |
175 | 175 | ||
176 | // create the gl buffer | 176 | // create the gl buffer |
177 | var gl = world.getGLContext(); | 177 | var gl = world.getGLContext(); |
diff --git a/js/helper-classes/RDGE/GLRectangle.js b/js/helper-classes/RDGE/GLRectangle.js index 5b6ff94f..3c1cb7dc 100755 --- a/js/helper-classes/RDGE/GLRectangle.js +++ b/js/helper-classes/RDGE/GLRectangle.js | |||
@@ -214,7 +214,7 @@ function GLRectangle() | |||
214 | if (!world._useWebGL) return; | 214 | if (!world._useWebGL) return; |
215 | 215 | ||
216 | // make sure RDGE has the correct context | 216 | // make sure RDGE has the correct context |
217 | g_Engine.setContext( world.getCanvas().uuid ); | 217 | g_Engine.setContext( world.getCanvas().rdgeid ); |
218 | 218 | ||
219 | // create the gl buffer | 219 | // create the gl buffer |
220 | var gl = world.getGLContext(); | 220 | var gl = world.getGLContext(); |
diff --git a/js/helper-classes/RDGE/GLWorld.js b/js/helper-classes/RDGE/GLWorld.js index 1edd5cff..0addcadc 100755 --- a/js/helper-classes/RDGE/GLWorld.js +++ b/js/helper-classes/RDGE/GLWorld.js | |||
@@ -136,13 +136,6 @@ function GLWorld( canvas, use3D ) | |||
136 | var camMat = Matrix.I(4); | 136 | var camMat = Matrix.I(4); |
137 | camMat[14] = this.getViewDistance(); | 137 | camMat[14] = this.getViewDistance(); |
138 | this.setCameraMat( camMat ); | 138 | this.setCameraMat( camMat ); |
139 | |||
140 | ////////////////////////////////////////// | ||
141 | // test call to SVG importer | ||
142 | // console.log( "***** SVG TEST *****" ); | ||
143 | // var svgImporter = new SVGParse( this ); | ||
144 | // svgImporter.importSVG(); | ||
145 | ////////////////////////////////////////// | ||
146 | 139 | ||
147 | // post-load processing of the scene |