aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/elements/body-controller.js20
-rwxr-xr-xjs/document/helpers/url-parser.js2
-rwxr-xr-xjs/document/mediators/template.js9
-rwxr-xr-xjs/document/views/design.js7
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js102
-rwxr-xr-xjs/helper-classes/3D/math-utils.js4
-rwxr-xr-xjs/helper-classes/3D/view-utils.js32
-rwxr-xr-xjs/helper-classes/RDGE/rdge-compiled.js12
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/runtime.js6
-rw-r--r--js/io/system/ninjalibrary.json2
-rwxr-xr-xjs/io/templates/files/html.txt6
-rwxr-xr-xjs/stage/layout.js3
12 files changed, 158 insertions, 47 deletions
diff --git a/js/controllers/elements/body-controller.js b/js/controllers/elements/body-controller.js
index 0ca6c417..604b22d0 100755
--- a/js/controllers/elements/body-controller.js
+++ b/js/controllers/elements/body-controller.js
@@ -19,6 +19,14 @@ exports.BodyController = Montage.create(ElementController, {
19 el.elementModel.props3D.matrix3d = mat; 19 el.elementModel.props3D.matrix3d = mat;
20 el.elementModel.props3D.perspectiveDist = dist; 20 el.elementModel.props3D.perspectiveDist = dist;
21 21
22 if(this.application.ninja.currentDocument.model.views.design._template) {
23 if(!MathUtils.isIdentityMatrix(mat)) {
24 el.parentNode.style.backgroundColor = "transparent";
25 } else {
26 el.parentNode.style.removeProperty("background-color");
27 }
28 }
29
22 this.application.ninja.stage.updatedStage = true; 30 this.application.ninja.stage.updatedStage = true;
23 31
24 if(update3DModel) { 32 if(update3DModel) {
@@ -32,7 +40,11 @@ exports.BodyController = Montage.create(ElementController, {
32 switch(p) { 40 switch(p) {
33 case "background" : 41 case "background" :
34 case "background-color": 42 case "background-color":
35 return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el, "background-color")); 43 if(this.application.ninja.currentDocument.model.views.design._template) {
44 return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el.parentNode, "background-color"));
45 } else {
46 return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el, "background-color"));
47 }
36 case "border": 48 case "border":
37 return 0; 49 return 0;
38 case "height": 50 case "height":
@@ -51,7 +63,11 @@ exports.BodyController = Montage.create(ElementController, {
51 switch(p) { 63 switch(p) {
52 case "background": 64 case "background":
53 case "background-color": 65 case "background-color":
54 this.application.ninja.stylesController.setElementStyle(el, "background-color", value); 66 if(this.application.ninja.currentDocument.model.views.design._template) {
67 this.application.ninja.stylesController.setElementStyle(el.parentNode, "background-color", value);
68 } else {
69 this.application.ninja.stylesController.setElementStyle(el, "background-color", value);
70 }
55 break; 71 break;
56 case "overflow": 72 case "overflow":
57 case "width": 73 case "width":
diff --git a/js/document/helpers/url-parser.js b/js/document/helpers/url-parser.js
index 5e71d148..7bded27d 100755
--- a/js/document/helpers/url-parser.js
+++ b/js/document/helpers/url-parser.js
@@ -53,7 +53,7 @@ exports.UrlParser = Montage.create(Component, {
53 //Getting file URI (not URL since we must load through I/O API) 53 //Getting file URI (not URL since we must load through I/O API)
54 var css = {}, file; 54 var css = {}, file;
55 css.cssUrl = href.split(this.application.ninja.coreIoApi.rootUrl)[1]; 55 css.cssUrl = href.split(this.application.ninja.coreIoApi.rootUrl)[1];
56 css.fileUri = this.application.ninja.coreIoApi.cloudData.root + css.cssUrl; 56 css.fileUri = this.application.ninja.coreIoApi.cloudData.root + unescape(css.cssUrl);
57 //Loading data from CSS file 57 //Loading data from CSS file
58 file = this.application.ninja.coreIoApi.readFile({uri: css.fileUri}); 58 file = this.application.ninja.coreIoApi.readFile({uri: css.fileUri});
59 //Checking for file to be writable on disk 59 //Checking for file to be writable on disk
diff --git a/js/document/mediators/template.js b/js/document/mediators/template.js
index c5b46c3a..f43b1a2c 100755
--- a/js/document/mediators/template.js
+++ b/js/document/mediators/template.js
@@ -158,6 +158,15 @@ exports.TemplateDocumentMediator = Montage.create(Component, {
158 ninjaContentTagDoc.removeAttribute('style'); 158 ninjaContentTagDoc.removeAttribute('style');
159 ninjaContentTagDoc.removeAttribute('data-ninja-style'); 159 ninjaContentTagDoc.removeAttribute('data-ninja-style');
160 } 160 }
161 // TODO - clean up into single method
162 ninjaContentTagMem = template.document.getElementsByTagName('ninja-viewport')[0], ninjaContentTagDoc = template.file.content.document.getElementsByTagName('ninja-viewport')[0];
163 if (ninjaContentTagMem && ninjaContentTagMem.getAttribute('data-ninja-style') !== null) {
164 ninjaContentTagDoc.setAttribute('style', ninjaContentTagMem.getAttribute('data-ninja-style'));
165 ninjaContentTagDoc.removeAttribute('data-ninja-style');
166 } else if (ninjaContentTagMem && ninjaContentTagMem.getAttribute('data-ninja-style') === null) {
167 ninjaContentTagDoc.removeAttribute('style');
168 ninjaContentTagDoc.removeAttribute('data-ninja-style');
169 }
161 } else { 170 } else {
162 if (template.body && template.body.getAttribute('data-ninja-style') !== null) { 171 if (template.body && template.body.getAttribute('data-ninja-style') !== null) {
163 template.file.content.document.body.setAttribute('style', template.body.getAttribute('data-ninja-style')); 172 template.file.content.document.body.setAttribute('style', template.body.getAttribute('data-ninja-style'));
diff --git a/js/document/views/design.js b/js/document/views/design.js
index 44c61617..d5c5c6c4 100755
--- a/js/document/views/design.js
+++ b/js/document/views/design.js
@@ -281,6 +281,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
281 this.document.body.removeChild(this.document.getElementsByTagName('ninjaloadinghack')[0]); 281 this.document.body.removeChild(this.document.getElementsByTagName('ninjaloadinghack')[0]);
282 //Getting style and link tags in document 282 //Getting style and link tags in document
283 var htags = this.document.getElementsByTagName('html'), 283 var htags = this.document.getElementsByTagName('html'),
284 bannerWrapper,
284 userStyles, 285 userStyles,
285 stags = this.document.getElementsByTagName('style'), 286 stags = this.document.getElementsByTagName('style'),
286 ltags = this.document.getElementsByTagName('link'), i, orgNodes, 287 ltags = this.document.getElementsByTagName('link'), i, orgNodes,
@@ -326,6 +327,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
326 //TODO: Verify appropiate location for this operation 327 //TODO: Verify appropiate location for this operation
327 if (this._template && this._template.type === 'banner') { 328 if (this._template && this._template.type === 'banner') {
328 this.documentRoot = this.document.body.getElementsByTagName('ninja-content')[0]; 329 this.documentRoot = this.document.body.getElementsByTagName('ninja-content')[0];
330 bannerWrapper = this.documentRoot.parentNode;
329 } else { 331 } else {
330 this.documentRoot = this.document.body; 332 this.documentRoot = this.document.body;
331 } 333 }
@@ -349,6 +351,11 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
349 this.documentRoot.setAttribute('data-ninja-style', userStyles); 351 this.documentRoot.setAttribute('data-ninja-style', userStyles);
350 } 352 }
351 } 353 }
354 if(bannerWrapper) {
355 if(userStyles = bannerWrapper.getAttribute('style')) {
356 bannerWrapper.setAttribute('data-ninja-style', userStyles);
357 }
358 }
352 //Making callback if specified 359 //Making callback if specified
353 if (this._callback) this._callback(); 360 if (this._callback) this._callback();
354 } 361 }
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index 8ddd0d52..87151964 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -630,6 +630,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
630 value: function () 630 value: function ()
631 { 631 {
632 this.application.ninja.stage.clearGridCanvas(); 632 this.application.ninja.stage.clearGridCanvas();
633 this.drawStageOutline();
633 if (!this.isDrawingGrid()) return; 634 if (!this.isDrawingGrid()) return;
634 635
635 var saveContext = this.getDrawingSurfaceElement(); 636 var saveContext = this.getDrawingSurfaceElement();
@@ -701,21 +702,6 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
701 this._lineColor = saveColor; 702 this._lineColor = saveColor;
702 this._drawingContext.lineWidth = saveLineWidth; 703 this._drawingContext.lineWidth = saveLineWidth;
703 704
704 if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") {
705 // draw an outline around the body
706 var stagePt = MathUtils.getPointOnPlane([0,0,1,0]);
707 var stageMat = this.getPlaneToWorldMatrix([0,0,1], stagePt);
708 // glmat4.multiply( tMat, stageMat, stageMat);
709 pt0 = [0, 0, 0];
710 pt1 = [0, height, 0];
711 delta = [width, 0, 0];
712 this.drawGridLines(pt0, pt1, delta, stageMat, 2);
713 pt0 = [0, 0, 0];
714 pt1 = [width, 0, 0];
715 delta = [0, height, 0];
716 this.drawGridLines(pt0, pt1, delta, stageMat, 2);
717 }
718
719 // draw the lines 705 // draw the lines
720 this.redrawGridLines(); 706 this.redrawGridLines();
721 707
@@ -738,15 +724,11 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
738 var sourceSpaceMat = this.viewUtils.getLocalToGlobalMatrix( this._sourceSpaceElt ); 724 var sourceSpaceMat = this.viewUtils.getLocalToGlobalMatrix( this._sourceSpaceElt );
739 for (var i = 0; i < nLines; i++) { 725 for (var i = 0; i < nLines; i++) {
740 // transform the points from working plane space to world space 726 // transform the points from working plane space to world space
741 //var t0 = mat.multiply(p0),
742 // t1 = mat.multiply(p1);
743 var t0 = glmat4.multiplyVec3( mat, p0, [] ), 727 var t0 = glmat4.multiplyVec3( mat, p0, [] ),
744 t1 = glmat4.multiplyVec3( mat, p1, [] ); 728 t1 = glmat4.multiplyVec3( mat, p1, [] );
745 729
746 // transform from world space to global screen space 730 // transform from world space to global screen space
747 if (this._sourceSpaceElt) { 731 if (this._sourceSpaceElt) {
748// t0 = this.viewUtils.localToGlobal(t0, this._sourceSpaceElt);
749// t1 = this.viewUtils.localToGlobal(t1, this._sourceSpaceElt);
750 t0 = this.viewUtils.localToGlobal2(t0, sourceSpaceMat); 732 t0 = this.viewUtils.localToGlobal2(t0, sourceSpaceMat);
751 t1 = this.viewUtils.localToGlobal2(t1, sourceSpaceMat); 733 t1 = this.viewUtils.localToGlobal2(t1, sourceSpaceMat);
752 } 734 }
@@ -764,9 +746,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
764 line.setVisibility(vis); 746 line.setVisibility(vis);
765 747
766 // increment the points to the next position 748 // increment the points to the next position
767// p0 = p0.add(d); p0[3] = 1.0;
768 p0 = vecUtils.vecAdd(4, p0, d); p0[3] = 1.0; 749 p0 = vecUtils.vecAdd(4, p0, d); p0[3] = 1.0;
769// p1 = p1.add(d); p1[3] = 1.0;
770 p1 = vecUtils.vecAdd(4, p1, d); p1[3] = 1.0; 750 p1 = vecUtils.vecAdd(4, p1, d); p1[3] = 1.0;
771 } 751 }