aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/elements/body-controller.js28
-rwxr-xr-xjs/controllers/selection-controller.js11
-rwxr-xr-xjs/document/document-html.js10
-rwxr-xr-xjs/document/models/html.js4
-rwxr-xr-xjs/document/templates/montage-web/index.html7
-rwxr-xr-xjs/document/views/design.js2
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js12
-rwxr-xr-xjs/helper-classes/3D/snap-manager.js12
-rwxr-xr-xjs/helper-classes/3D/view-utils.js8
-rwxr-xr-xjs/io/templates/files/html.txt4
-rwxr-xr-xjs/mediators/keyboard-mediator.js31
-rwxr-xr-xjs/ninja.reel/ninja.js2
-rwxr-xr-xjs/stage/layout.js2
-rwxr-xr-xjs/tools/RotateStage3DTool.js20
-rwxr-xr-xjs/tools/SelectionTool.js5
-rwxr-xr-xjs/tools/ZoomTool.js4
16 files changed, 82 insertions, 80 deletions
diff --git a/js/controllers/elements/body-controller.js b/js/controllers/elements/body-controller.js
index 14aeae24..943594f2 100755
--- a/js/controllers/elements/body-controller.js
+++ b/js/controllers/elements/body-controller.js
@@ -28,11 +28,39 @@ exports.BodyController = Montage.create(ElementController, {
28 28
29 getProperty: { 29 getProperty: {
30 value: function(el, p) { 30 value: function(el, p) {
31 switch(p) {
32 case "background" :
33 return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el, "background-color", true, true));
34 case "border":
35 return 0;
36 case "height":
37 case "width":
38 case "-webkit-transform-style":
39 return this.application.ninja.stylesController.getElementStyle(el, p, true, true);
40 default:
41 return ElementController.getProperty(el, p, true, true);
42 //console.log("Undefined Stage property ", p);
43 }
31 } 44 }
32 }, 45 },
33 46
34 setProperty: { 47 setProperty: {
35 value: function(el, p, value) { 48 value: function(el, p, value) {
49 switch(p) {
50 case "body-background":
51 case "background":
52 this.application.ninja.stylesController.setElementStyle(el, "background-color", value, true);
53 break;
54 case "overflow":
55 case "width":
56 case "height":
57 case "-webkit-transform-style":
58 this.application.ninja.stylesController.setElementStyle(el, p, value, true);
59 this.application.ninja.stage.updatedStage = true;
60 break;
61 default:
62 console.log("Undefined property ", p, "for the Body Controller");
63 }
36 } 64 }
37 }, 65 },
38 66
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index 2bd774f5..a81cdf7f 100755
--- a/js/controllers/selection-controller.js
+++ b/js/controllers/selection-controller.js
@@ -112,12 +112,12 @@ exports.SelectionController = Montage.create(Component, {
112 112
113 handleSelectAll: { 113 handleSelectAll: {
114 value: function(event) { 114 value: function(event) {
115 var selected = [], childNodes = []; 115 var selected = [], childNodes = [], self = this;
116 116
117 childNodes = this.application.ninja.currentDocument.documentRoot.childNodes; 117 childNodes = this.application.ninja.currentDocument.documentRoot.childNodes;
118 childNodes = Array.prototype.slice.call(childNodes, 0); 118 childNodes = Array.prototype.slice.call(childNodes, 0);
119 childNodes.forEach(function(item) { 119 childNodes.forEach(function(item) {
120 if(item.nodeType == 1) { 120 if(self.isNodeTraversable(item)) {
121 selected.push(item); 121 selected.push(item);
122 } 122 }
123 }); 123 });
@@ -280,6 +280,13 @@ exports.SelectionController = Montage.create(Component, {
280 280
281 return -1; 281 return -1;
282 } 282 }
283 },
284
285 isNodeTraversable: {
286 value: function( item ) {
287 if(item.nodeType !== 1) return false;
288 return ((item.nodeName !== "STYLE") && (item.nodeName !== "SCRIPT"));
289 }
283 } 290 }
284 291
285}); 292});
diff --git a/js/document/document-html.js b/js/document/document-html.js
index deca9f83..f3c135ed 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -41,7 +41,7 @@ exports.HtmlDocument = Montage.create(Component, {
41 //////////////////////////////////////////////////////////////////// 41 ////////////////////////////////////////////////////////////////////
42 // 42 //
43 exclusionList: { 43 exclusionList: {
44 value: [] //TODO: Update to correct list 44 value: ["HTML", "BODY"] //TODO: Update to correct list
45 }, 45 },
46 //////////////////////////////////////////////////////////////////// 46 ////////////////////////////////////////////////////////////////////
47 // 47 //
@@ -73,7 +73,7 @@ exports.HtmlDocument = Montage.create(Component, {
73 views: {value: {'design': DesignDocumentView.create(), 'code': null}} //TODO: Add code view logic 73 views: {value: {'design': DesignDocumentView.create(), 'code': null}} //TODO: Add code view logic
74 }); 74 });
75 //Initiliazing views and hiding 75 //Initiliazing views and hiding
76 if (this.model.views.design.initiliaze(document.getElementById("iframeContainer"))) { 76 if (this.model.views.design.initialize(document.getElementById("iframeContainer"))) {
77 //Hiding iFrame, just initiliazing 77 //Hiding iFrame, just initiliazing
78 this.model.views.design.hide(); 78 this.model.views.design.hide();
79 } else { 79 } else {
@@ -115,6 +115,12 @@ exports.HtmlDocument = Montage.create(Component, {
115 this.loaded.callback.call(this.loaded.context, this); 115 this.loaded.callback.call(this.loaded.context, this);
116 //Setting opacity to be viewable after load 116 //Setting opacity to be viewable after load
117 this.model.views.design.iframe.style.opacity = 1; 117 this.model.views.design.iframe.style.opacity = 1;
118
119
120
121
122
123 this.application.ninja.appModel.show3dGrid = true;
118 } 124 }
119 } 125 }
120 //////////////////////////////////////////////////////////////////// 126 ////////////////////////////////////////////////////////////////////
diff --git a/js/document/models/html.js b/js/document/models/html.js
index f45a0e21..5eedb731 100755
--- a/js/document/models/html.js
+++ b/js/document/models/html.js
@@ -15,6 +15,10 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, {
15 // 15 //
16 hasTemplate: { 16 hasTemplate: {
17 value: false 17 value: false
18 },
19
20 draw3DGrid: {
21 value: false
18 } 22 }
19 //////////////////////////////////////////////////////////////////// 23 ////////////////////////////////////////////////////////////////////
20 //////////////////////////////////////////////////////////////////// 24 ////////////////////////////////////////////////////////////////////
diff --git a/js/document/templates/montage-web/index.html b/js/document/templates/montage-web/index.html
index 1c6b6287..47964ae4 100755
--- a/js/document/templates/montage-web/index.html
+++ b/js/document/templates/montage-web/index.html
@@ -23,8 +23,13 @@
23 padding: 0; 23 padding: 0;
24 position: absolute; 24 position: absolute;
25 -webkit-transform-style: preserve-3d; 25 -webkit-transform-style: preserve-3d;
26 -webkit-perspective: 1400px; 26 -webkit-transform: perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
27 } 27 }
28
29 html, body {
30 width: 100%;
31 height: 100%;
32 }
28 33
29 ninjaloadinghack { 34 ninjaloadinghack {
30 display: none; 35 display: none;
diff --git a/js/document/views/design.js b/js/document/views/design.js
index 4f598305..6cce229c 100755
--- a/js/document/views/design.js
+++ b/js/document/views/design.js
@@ -49,7 +49,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
49 }, 49 },
50 //////////////////////////////////////////////////////////////////// 50 ////////////////////////////////////////////////////////////////////
51 // 51 //
52 initiliaze: { 52 initialize: {
53 value: function (parent) { 53 value: function (parent) {
54 //Creating iFrame for view 54 //Creating iFrame for view
55 this.iframe = document.createElement("iframe"); 55 this.iframe = document.createElement("iframe");
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index 88830964..f869f65e 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -584,18 +584,10 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
584 var ptOnPlane = MathUtils.getPointOnPlane(this._workingPlane); 584 var ptOnPlane = MathUtils.getPointOnPlane(this._workingPlane);
585 585
586 // define the grid parameters 586 // define the grid parameters
587 var width, 587 var width = this.snapManager.getStageWidth(),
588 height, 588 height = this.snapManager.getStageHeight(),
589 nLines = 10; 589 nLines = 10;
590 590
591// if(this.application.ninja.documentController.webTemplate) {
592 if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") {
593 width = this.application.ninja.currentDocument.documentRoot.scrollWidth;
594 height = this.application.ninja.currentDocument.documentRoot.scrollHeight;
595 } else {
596 width = this.snapManager.getStageWidth();
597 height = this.snapManager.getStageHeight();
598 }
599 // get a matrix from working plane space to the world 591 // get a matrix from working plane space to the world
600 var mat = this.getPlaneToWorldMatrix(zAxis, ptOnPlane); 592 var mat = this.getPlaneToWorldMatrix(zAxis, ptOnPlane);
601 var tMat = Matrix.Translation( [0.5*width, 0.5*height, 0] ); 593 var tMat = Matrix.Translation( [0.5*width, 0.5*height, 0] );
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js
index f4bfc12b..31e3e540 100755
--- a/js/helper-classes/3D/snap-manager.js
+++ b/js/helper-classes/3D/snap-manager.js
@@ -1617,11 +1617,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1617 if (x > y) { 1617 if (x > y) {