aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjs/controllers/elements/body-controller.js28
-rwxr-xr-xjs/controllers/selection-controller.js11
-rwxr-xr-xjs/document/templates/montage-web/index.html7
-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/stage/layout.js2
-rwxr-xr-xjs/tools/RotateStage3DTool.js18
-rwxr-xr-xjs/tools/SelectionTool.js5
10 files changed, 61 insertions, 46 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/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/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) {
1618 if (x > z) { 1618 if (x > z) {
1619 plane[0] = 1; 1619 plane[0] = 1;
1620 if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { 1620 plane[3] = this.getStageWidth() / 2.0;
1621 plane[3] = stage.scrollWidth / 2.0;
1622 } else {
1623 plane[3] = this.getStageWidth() / 2.0;
1624 }
1625 if (dir[0] > 0) plane[3] = -plane[3]; 1621 if (dir[0] > 0) plane[3] = -plane[3];
1626 change = !drawUtils.drawYZ; 1622 change = !drawUtils.drawYZ;
1627 drawUtils.drawXY = drawUtils.drawXZ = false; 1623 drawUtils.drawXY = drawUtils.drawXZ = false;
@@ -1639,11 +1635,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1639 else { 1635 else {
1640 if (y > z) { 1636 if (y > z) {
1641 plane[1] = 1; 1637 plane[1] = 1;
1642 if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { 1638 plane[3] = this.getStageHeight() / 2.0;
1643 plane[3] = stage.scrollHeight / 2.0;
1644 } else {
1645 plane[3] = this.getStageHeight() / 2.0;
1646 }
1647 if (dir[1] > 0) plane[3] = -plane[3]; 1639 if (dir[1] > 0) plane[3] = -plane[3];
1648 change = !drawUtils.drawXZ; 1640 change = !drawUtils.drawXZ;
1649 drawUtils.drawXY = drawUtils.drawYZ = false; 1641 drawUtils.drawXY = drawUtils.drawYZ = false;
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js
index 40a19b90..36d6f8c4 100755
--- a/js/helper-classes/3D/view-utils.js
+++ b/js/helper-classes/3D/view-utils.js
@@ -309,11 +309,12 @@ exports.ViewUtils = Montage.create(Component, {
309 // transform the bounds up the tree 309 // transform the bounds up the tree
310 var child = elt; 310 var child = elt;
311 var parent = elt.offsetParent; 311 var parent = elt.offsetParent;
312 while ( parent ) 312 while ( child )
313 { 313 {
314 pt = this.childToParent( pt, child ); 314 pt = this.childToParent( pt, child );
315 315
316 if (parent === this._rootElement) break; 316// if (parent === this._rootElement) break;
317 if (child === this._stageElement) break;
317 318
318 child = parent; 319 child = parent;
319 parent = parent.offsetParent; 320 parent = parent.offsetParent;
@@ -352,7 +353,8 @@ exports.ViewUtils = Montage.create(Component, {
352 353
353 // transform the bounds up the tree 354 // transform the bounds up the tree
354 var parent = child.offsetParent; 355 var parent = child.offsetParent;
355 if ( parent ) 356 // TODO - Should have a different way to check for new template mode
357 if ( parent || ((child === this.application.ninja.currentDocument.documentRoot) && (child.id !== "UserContent")) )
356 { 358 {
357 this.setViewportObj( child ); 359 this.setViewportObj( child );
358 360
diff --git a/js/io/templates/files/html.txt b/js/io/templates/files/html.txt
index 15641348..4e42267e 100755
--- a/js/io/templates/files/html.txt
+++ b/js/io/templates/files/html.txt
@@ -9,6 +9,10 @@
9 <meta name="generator" content="Motorola Mobility Ninja"> 9 <meta name="generator" content="Motorola Mobility Ninja">
10 10
11 <style type="text/css"> 11 <style type="text/css">
12 html, body {