aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/document-html.js46
-rwxr-xr-xjs/document/html-document.js28
-rwxr-xr-xjs/document/models/base.js8
-rwxr-xr-xjs/document/templates/montage-html/index.html3
-rwxr-xr-xjs/document/templates/montage-html/package.json3
-rwxr-xr-xjs/document/templates/montage-web/default_html.css11
-rwxr-xr-xjs/document/templates/montage-web/index.html15
7 files changed, 84 insertions, 30 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js
index 8cb88516..89717dd6 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -31,6 +31,10 @@ exports.HtmlDocument = Montage.create(Component, {
31 value: null 31 value: null
32 }, 32 },
33 33
34 exclusionList: {
35 value: ["HTML", "BODY"]
36 },
37
34 // Getters for the model. 38 // Getters for the model.
35 // TODO: Change how these properties are accessed through Ninja 39 // TODO: Change how these properties are accessed through Ninja
36 name: { 40 name: {
@@ -42,6 +46,24 @@ exports.HtmlDocument = Montage.create(Component, {
42 } 46 }
43 }, 47 },
44 48
49 isActive: {
50 get: function() {
51 return this.model._isActive;
52 },
53 set: function(value) {
54 this.model._isActive = value;
55 }
56 },
57
58 needsSave: {
59 get: function() {
60 return this.model._needsSave;
61 },
62 set: function(value) {
63 this.model._needsSave = value;
64 }
65 },
66
45 // View Properties 67 // View Properties
46 // TODO: Move those into a view object - for now dump it here 68 // TODO: Move those into a view object - for now dump it here
47 iframe: { 69 iframe: {
@@ -53,6 +75,10 @@ exports.HtmlDocument = Montage.create(Component, {
53 return this._uuid; 75 return this._uuid;
54 } 76 }
55 }, 77 },
78
79 currentView: {
80 value: "design"
81 },
56 //////////////////////////////////////////////////////////////////// 82 ////////////////////////////////////////////////////////////////////
57 //////////////////////////////////////////////////////////////////// 83 ////////////////////////////////////////////////////////////////////
58 init: { 84 init: {
@@ -270,7 +296,8 @@ exports.HtmlDocument = Montage.create(Component, {
270 296
271 //TODO Finish this implementation once we start caching Core Elements 297 //TODO Finish this implementation once we start caching Core Elements
272 // Assign a model to the UserContent and add the ViewPort reference to it. 298 // Assign a model to the UserContent and add the ViewPort reference to it.
273 document.application.njUtils.makeElementModel(this.documentRoot, "Stage", "stage"); 299 document.application.njUtils.makeElementModel(this.documentRoot, "Body", "body");
300// this.documentRoot.elementModel.props3D.init(this.documentRoot, true);
274 301
275 for(i = 0; i < this._stylesheets.length; i++) { 302 for(i = 0; i < this._stylesheets.length; i++) {
276 if(this._stylesheets[i].ownerNode.id === "nj-stage-stylesheet") { 303 if(this._stylesheets[i].ownerNode.id === "nj-stage-stylesheet") {
@@ -309,6 +336,23 @@ exports.HtmlDocument = Montage.create(Component, {
309 } 336 }
310 }, 337 },
311 338
339 GetElementFromPoint: {
340 value: function(x, y) {
341 return this._window.getElement(x,y);
342 }
343 },
344
345 inExclusion: {
346 value: function(element) {
347 if(this.exclusionList.indexOf(element.nodeName) === -1) {
348 return -1;
349 }
350
351 return 1;
352
353 }
354 },
355
312 // Handler for user content main reel. Gets called once the main reel of the template 356 // Handler for user content main reel. Gets called once the main reel of the template
313 // gets deserialized. 357 // gets deserialized.
314 // Setting up the currentSelectedContainer to the document body. 358 // Setting up the currentSelectedContainer to the document body.
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 3876670c..9d083dd8 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -207,16 +207,16 @@ exports.HTMLDocument = Montage.create(TextDocument, {
207 var elt = this.documentRoot; 207 var elt = this.documentRoot;
208 if (elt) 208 if (elt)
209 { 209 {
210 /*
211 // Use this code to test the runtime version of WebGL
212 var cdm = new NinjaCvsRt.CanvasDataManager();
213 cdm.loadGLData(elt, value, null );
214 */
215
216 // /*
210 var nWorlds= value.length; 217 var nWorlds= value.length;
211 for (var i=0; i<nWorlds; i++) 218 for (var i=0; i<nWorlds; i++)
212 { 219 {
213 /*
214 // Use this code to test the runtime version of WebGL
215 var cdm = new NinjaCvsRt.CanvasDataManager();
216 cdm.loadGLData(elt, value, null );
217 */
218
219 // /*
220 // get the data for the next canvas 220 // get the data for the next canvas
221 var importStr = value[i]; 221 var importStr = value[i];
222 222
@@ -228,7 +228,7 @@ exports.HTMLDocument = Montage.create(TextDocument, {
228 { 228 {
229 // JSON format. pull off the 229 // JSON format. pull off the
230 importStr = importStr.substr( index+1 ); 230 importStr = importStr.substr( index+1 );
231 jObj = jObj = JSON.parse( importStr ); 231 jObj = JSON.parse( importStr );
232 id = jObj.id; 232 id = jObj.id;
233 } 233 }
234 else 234 else
@@ -281,8 +281,8 @@ exports.HTMLDocument = Montage.create(TextDocument, {
281 } 281 }
282 } 282 }
283 } 283 }
284 // */
285 } 284 }
285 // */
286 } 286 }
287 } 287 }
288 }, 288 },
@@ -759,10 +759,14 @@ exports.HTMLDocument = Montage.create(TextDocument, {
759 //TODO Finish this implementation once we start caching Core Elements 759 //TODO Finish this implementation once we start caching Core Elements
760 // Assign a model to the UserContent and add the ViewPort reference to it. 760 // Assign a model to the UserContent and add the ViewPort reference to it.
761 NJUtils.makeElementModel(this.documentRoot, "Stage", "stage"); 761 NJUtils.makeElementModel(this.documentRoot, "Stage", "stage");
762 //this.documentRoot.elementModel.viewPort = this.iframe.contentWindow.document.getElementById("Viewport"); 762 NJUtils.makeElementModel(this.stageBG, "Stage", "stage");
763 NJUtils.makeElementModel(this.stageBG, "Stage", "stage");
764 NJUtils.makeElementModel(this.iframe.contentWindow.document.getElementById("Viewport"), "Stage", "stage"); 763 NJUtils.makeElementModel(this.iframe.contentWindow.document.getElementById("Viewport"), "Stage", "stage");
765 764
765 // Initialize the 3D properties
766 this.documentRoot.elementModel.props3D.init(this.documentRoot, true);
767 this.stageBG.elementModel.props3D.init(this.stageBG, true);
768 this.iframe.contentWindow.document.getElementById("Viewport").elementModel.props3D.init(this.iframe.contentWindow.document.getElementById("Viewport"), true);
769
766 for(i = 0; i < this._stylesheets.length; i++) { 770 for(i = 0; i < this._stylesheets.length; i++) {
767 if(this._stylesheets[i].ownerNode.id === this._stageStyleSheetId) { 771 if(this._stylesheets[i].ownerNode.id === this._stageStyleSheetId) {
768 this.documentRoot.elementModel.defaultRule = this._stylesheets[i]; 772 this.documentRoot.elementModel.defaultRule = this._stylesheets[i];
diff --git a/js/document/models/base.js b/js/document/models/base.js
index 8925fc40..f237e793 100755
--- a/js/document/models/base.js
+++ b/js/document/models/base.js
@@ -25,6 +25,14 @@ exports.BaseDocumentModel = Montage.create(Montage, {
25 _name: { 25 _name: {
26 value: null 26 value: null
27 }, 27 },
28
29 _isActive: {
30 value: null
31 },
32
33 _needsSave: {
34 value: null
35 },
28 //////////////////////////////////////////////////////////////////// 36 ////////////////////////////////////////////////////////////////////
29 // 37 //
30 njdata: { 38 njdata: {
diff --git a/js/document/templates/montage-html/index.html b/js/document/templates/montage-html/index.html
index b3f68030..79c6cd51 100755
--- a/js/document/templates/montage-html/index.html
+++ b/js/document/templates/montage-html/index.html
@@ -24,8 +24,7 @@
24 <script type="text/montage-serialization"> 24 <script type="text/montage-serialization">
25 { 25 {
26 "owner": { 26 "owner": {
27 "module": "main.reel", 27 "prototype": "main.reel"
28 "name": "Main"
29 } 28 }
30 } 29 }
31 </script> 30 </script>
diff --git a/js/document/templates/montage-html/package.json b/js/document/templates/montage-html/package.json
index c8bc02fb..d1e839dc 100755
--- a/js/document/templates/montage-html/package.json
+++ b/js/document/templates/montage-html/package.json
@@ -3,6 +3,7 @@
3 "lib": "" 3 "lib": ""
4 }, 4 },
5 "mappings": { 5 "mappings": {
6 "montage": "../../../../node_modules/montage/" 6 "montage": "../../../../node_modules/montage/",
7 "montage-google": "../../../../node_modules/montage-google/"
7 } 8 }
8} \ No newline at end of file 9} \ No newline at end of file
diff --git a/js/document/templates/montage-web/default_html.css b/js/document/templates/montage-web/default_html.css
index db069d4e..e62a20a9 100755
--- a/js/document/templates/montage-web/default_html.css
+++ b/js/document/templates/montage-web/default_html.css
@@ -10,8 +10,17 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot