aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-03 10:58:03 -0700
committerValerio Virgillito2012-05-03 10:58:03 -0700
commitbe1806505f4af86c3b5c15454e67cb8cec696554 (patch)
tree137be320b75d29c295b332d381bd1851241887a6 /js
parent30bf02869c93072cdb3a3a8b50cf943917f3b026 (diff)
parent691beb1c39fc0baa683f1fc56cbc519fe58f306d (diff)
downloadninja-be1806505f4af86c3b5c15454e67cb8cec696554.tar.gz
Merge branch 'refs/heads/master' into data-id
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/document-controller.js2
-rwxr-xr-xjs/controllers/elements/body-controller.js51
-rwxr-xr-xjs/document/html-document.js18
-rwxr-xr-xjs/document/templates/montage-web/default_html.css9
-rwxr-xr-xjs/document/templates/montage-web/index.html12
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js61
-rwxr-xr-xjs/helper-classes/3D/snap-manager.js291
-rwxr-xr-xjs/lib/drawing/world.js11
-rwxr-xr-xjs/lib/geom/circle.js61
-rwxr-xr-xjs/lib/geom/geom-obj.js59
-rwxr-xr-xjs/lib/geom/rectangle.js40
-rwxr-xr-xjs/stage/layout.js2
-rwxr-xr-xjs/stage/stage.reel/stage.js73
-rwxr-xr-xjs/tools/OvalTool.js2
-rwxr-xr-xjs/tools/PanTool.js20
-rwxr-xr-xjs/tools/RotateStage3DTool.js18
-rwxr-xr-xjs/tools/SelectionTool.js6
-rwxr-xr-xjs/tools/ShapeTool.js41
-rwxr-xr-xjs/tools/drawing-tool-base.js64
-rwxr-xr-xjs/tools/drawing-tool.js3
20 files changed, 549 insertions, 295 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 4be0767a..7795a74d 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -483,6 +483,8 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
483 483
484 if(!this.webTemplate) { 484 if(!this.webTemplate) {
485 this._showCurrentDocument(); 485 this._showCurrentDocument();
486 } else {
487 this.application.ninja.stage.stageView.showRulers();
486 } 488 }
487 489
488 this.webTemplate = false; 490 this.webTemplate = false;
diff --git a/js/controllers/elements/body-controller.js b/js/controllers/elements/body-controller.js
index fbbb7c6e..14aeae24 100755
--- a/js/controllers/elements/body-controller.js
+++ b/js/controllers/elements/body-controller.js
@@ -12,6 +12,17 @@ exports.BodyController = Montage.create(ElementController, {
12 // TODO - perspective distance needs to be passed in as "dist" and matrix3d needs to be passed in as "mat" 12 // TODO - perspective distance needs to be passed in as "dist" and matrix3d needs to be passed in as "mat"
13 set3DProperties: { 13 set3DProperties: {
14 value: function(el, props, update3DModel) { 14 value: function(el, props, update3DModel) {
15 var dist = props["dist"], mat = props["mat"];
16 this.application.ninja.stylesController.setElementStyle(el, "-webkit-transform", "perspective(" + dist + ") " + "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")", true);
17
18 el.elementModel.props3D.matrix3d = mat;
19 el.elementModel.props3D.perspectiveDist = dist;
20
21 this.application.ninja.stage.updatedStage = true;
22
23 if(update3DModel) {
24 this._update3DProperties(el, mat, dist);
25 }
15 } 26 }
16 }, 27 },
17 28
@@ -40,5 +51,45 @@ exports.BodyController = Montage.create(ElementController, {
40 return dist; 51 return dist;
41 } 52 }
42 } 53 }
54 },
55
56 getMatrix: {
57 value: function(el) {
58 if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.matrix3d)
59 {
60 return el.elementModel.props3D.matrix3d.slice(0);
61 }
62 else
63 {
64 var mat;
65
66 if (el)
67 {
68 mat = this.application.ninja.stylesController.getMatrixFromElement(el, true);
69 if (!mat) {
70 mat = Matrix.I(4);
71 }
72
73 var zoom = this.application.ninja.elementMediator.getProperty(el, "zoom");
74 if (zoom)
75 {
76 zoom = Number(zoom);
77 if (zoom != 1)
78 {
79 var zoomMat = Matrix.create( [
80 [ zoom, 0, 0, 0],
81 [ 0, zoom, 0, 0],
82 [ 0, 0, zoom, 0],
83 [ 0, 0, 0, 1]
84 ] );
85 glmat4.multiply( zoomMat, mat, mat );
86 }
87 }
88 }
89
90 el.elementModel.props3D.matrix3d = mat;
91 return mat;
92 }
93 }
43 } 94 }
44}); 95});
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 3dbf96ce..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 },
diff --git a/js/document/templates/montage-web/default_html.css b/js/document/templates/montage-web/default_html.css
index 08e39f22..e62a20a9 100755
--- a/js/document/templates/montage-web/default_html.css
+++ b/js/document/templates/montage-web/default_html.css
@@ -10,6 +10,15 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
10 -webkit-animation-name: none !important; 10 -webkit-animation-name: none !important;
11} 11}
12 12
13body {
14 margin: 0;
15 padding: 0;
16
17 position: absolute;
18 -webkit-transform-style: preserve-3d;
19 -webkit-perspective: 1400px;
20}
21
13.active-element-outline { 22.active-element-outline {
14 outline: #adff2f solid 2px; 23 outline: #adff2f solid 2px;
15} 24}
diff --git a/js/document/templates/montage-web/index.html b/js/document/templates/montage-web/index.html
index 630794a4..caebc8d0 100755
--- a/js/document/templates/montage-web/index.html
+++ b/js/document/templates/montage-web/index.html
@@ -29,20 +29,10 @@
29 } 29 }
30 </script> 30 </script>
31 31
32 <style>
33 div {
34 width: 4000px;
35 height: 300px;
36 background: red;
37 }
38 </style>
39
40 </head> 32 </head>
41 33
42 <body> 34 <body>
43 35 <style></style>
44 <!--<div>IPSUM</div>-->
45
46 </body> 36 </body>
47 37
48</html> \ No newline at end of file 38</html> \ No newline at end of file
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index 7bd77c3a..88830964 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -583,17 +583,25 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
583 // get a point that lies on the plane 583 // get a point that lies on the plane
584 var ptOnPlane = MathUtils.getPointOnPlane(this._workingPlane); 584 var ptOnPlane = MathUtils.getPointOnPlane(this._workingPlane);