aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-05-04 14:42:00 -0700
committerNivesh Rajbhandari2012-05-04 14:42:00 -0700
commit8f8f7f9a36fb9abadea2a9f25aef0084946bebc9 (patch)
treef6c756f20b302415ac3dae5ea2e1f5788b7bfe94
parent8f1385d4aa12173fb4d9af695b8e5036f675b621 (diff)
downloadninja-8f8f7f9a36fb9abadea2a9f25aef0084946bebc9.tar.gz
Removed special-casing for new template workflow. Instead, we will enforce a width and height on the body in order to do 3d.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
-rwxr-xr-xjs/controllers/elements/body-controller.js28
-rwxr-xr-xjs/document/templates/montage-web/default_html.css5
-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/tools/RotateStage3DTool.js18
6 files changed, 42 insertions, 41 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/document/templates/montage-web/default_html.css b/js/document/templates/montage-web/default_html.css
index e62a20a9..7979d1e9 100755
--- a/js/document/templates/montage-web/default_html.css
+++ b/js/document/templates/montage-web/default_html.css
@@ -16,7 +16,10 @@ body {
16 16
17 position: absolute; 17 position: absolute;
18 -webkit-transform-style: preserve-3d; 18 -webkit-transform-style: preserve-3d;
19 -webkit-perspective: 1400px; 19 -webkit-transform: perspective(1400) matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);
20
21 width: 1460px;
22 height: 880px;
20} 23}
21 24
22.active-element-outline { 25.active-element-outline {
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/tools/RotateStage3DTool.js b/js/tools/RotateStage3DTool.js
index 2a9c63db..90cbe95e 100755
--- a/js/tools/RotateStage3DTool.js
+++ b/js/tools/RotateStage3DTool.js
@@ -96,12 +96,6 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, {
96 viewUtils.pushViewportObj( stage ); 96 viewUtils.pushViewportObj( stage );
97 var eltCtr = viewUtils.getCenterOfProjection(); 97 var eltCtr = viewUtils.getCenterOfProjection();
98 viewUtils.popViewportObj(); 98 viewUtils.popViewportObj();
99// if(this.application.ninja.documentController.webTemplate)
100 if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent")
101 {
102 eltCtr[0] = stage.scrollWidth/2;
103 eltCtr[1] = stage.scrollHeight/2;
104 }
105 99
106 var curMat = viewUtils.getMatrixFromElement(stage); 100 var curMat = viewUtils.getMatrixFromElement(stage);
107 var curMatInv = glmat4.inverse(curMat, []); 101 var curMatInv = glmat4.inverse(curMat, []);
@@ -118,17 +112,7 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, {
118 } 112 }
119 113
120 this._origin = viewUtils.localToGlobal(eltCtr, stage); 114 this._origin = viewUtils.localToGlobal(eltCtr, stage);
121 115 this._setTransformOrigin(false);
122// if(this.application.ninja.documentController.webTemplate)
123 if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent")
124 {
125 this._startOriginArray = [];
126 this._startOriginArray.push(this._origin.slice());
127 }
128 else
129 {
130 this._setTransformOrigin(false);
131 }
132 this.DrawHandles(); 116 this.DrawHandles();
133 } 117 }
134 }, 118 },