diff options
Diffstat (limited to 'js')
-rwxr-xr-x | js/controllers/document-controller.js | 2 | ||||
-rwxr-xr-x | js/controllers/elements/body-controller.js | 11 | ||||
-rwxr-xr-x | js/document/html-document.js | 18 | ||||
-rwxr-xr-x | js/document/templates/montage-web/default_html.css | 9 | ||||
-rwxr-xr-x | js/document/templates/montage-web/index.html | 12 | ||||
-rwxr-xr-x | js/helper-classes/3D/snap-manager.js | 279 | ||||
-rwxr-xr-x | js/lib/drawing/world.js | 11 | ||||
-rwxr-xr-x | js/lib/geom/circle.js | 61 | ||||
-rwxr-xr-x | js/lib/geom/geom-obj.js | 59 | ||||
-rwxr-xr-x | js/lib/geom/rectangle.js | 40 | ||||
-rwxr-xr-x | js/stage/layout.js | 2 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.js | 73 | ||||
-rwxr-xr-x | js/tools/OvalTool.js | 2 | ||||
-rwxr-xr-x | js/tools/PanTool.js | 20 | ||||
-rwxr-xr-x | js/tools/SelectionTool.js | 6 | ||||
-rwxr-xr-x | js/tools/ShapeTool.js | 38 | ||||
-rwxr-xr-x | js/tools/drawing-tool-base.js | 13 |
17 files changed, 397 insertions, 259 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..839d0787 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 | ||
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 | ||
13 | body { | ||
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/snap-manager.js b/js/helper-classes/3D/snap-manager.js index cd8cc102..7fc492a5 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js | |||
@@ -948,7 +948,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
948 | { | 948 | { |
949 | 949 | ||
950 | // see if we can snap to a contained geometry object | 950 | // see if we can snap to a contained geometry object |
951 | if (hitRec && this.getGLWorld(elt) && !this.isARectangle(elt)) | 951 | if (hitRec && this.getGLWorld(elt)) // && !this.isARectangle(elt)) |
952 | { | 952 | { |
953 | var localPt = hitRec.calculateElementWorldPoint(); | 953 | var localPt = hitRec.calculateElementWorldPoint(); |
954 | if (hitRec.getType() != hitRec.SNAP_TYPE_ELEMENT) | 954 | if (hitRec.getType() != hitRec.SNAP_TYPE_ELEMENT) |
@@ -1011,7 +1011,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1011 | } | 1011 | } |
1012 | // hit test the current object | 1012 | // hit test the current object |
1013 | var hit; | 1013 | var hit; |
1014 | if (depth > 0) // don't snap to the root | 1014 | var snapToStage = ((depth === 0) && (elt === this.application.ninja.currentSelectedContainer) && (elt.nodeName === 'CANVAS')); |
1015 | if ((depth > 0) || snapToStage) // don't snap to the root unles we are working inside a canvas | ||
1015 | { | 1016 | { |
1016 | // if the element is in the 2D cache snapping is done there | 1017 | // if the element is in the 2D cache snapping is done there |
1017 | if (elt.elementModel && !elt.elementModel.isIn2DSnapCache) | 1018 | if (elt.elementModel && !elt.elementModel.isIn2DSnapCache) |
@@ -1077,7 +1078,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1077 | var hitRec = this.snapToScreenBounds( elt, globalScrPt, bounds, bounds3D ); | 1078 | var hitRec = this.snapToScreenBounds( elt, globalScrPt, bounds, bounds3D ); |
1078 | 1079 | ||
1079 | // see if we can snap to a contained geometry object | 1080 | // see if we can snap to a contained geometry object |
1080 | if (hitRec && this.getGLWorld(elt) && !this.isARectangle(elt)) | 1081 | if (hitRec && this.getGLWorld(elt)) // && !this.isARectangle(elt)) |
1081 | { | 1082 | { |
1082 | var localPt = hitRec.calculateElementWorldPoint(); | 1083 | var localPt = hitRec.calculateElementWorldPoint(); |
1083 | if (hitRec.getType() != hitRec.SNAP_TYPE_ELEMENT) | 1084 | if (hitRec.getType() != hitRec.SNAP_TYPE_ELEMENT) |
@@ -1320,193 +1321,135 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1320 | } | 1321 | } |
1321 | }, | 1322 | }, |
1322 | 1323 | ||
1323 | snapToContainedElement : | 1324 | doSnapToContainedElement: |
1324 | { | 1325 | { |
1325 | value: function( eyePt, dir, glObj, hitRec, targetScrPt ) | 1326 | value: function( eyePt, dir, glObj, hitRec, targetScrPt ) |
1326 | { | 1327 | { |
1327 | var rtnVal = false; | 1328 | var rtnVal = false; |
1328 | var elt = hitRec.getElement(); | ||
1329 | 1329 | ||
1330 | var elt = hitRec.getElt(); | ||
1330 | var world = glObj.getWorld(); | 1331 | var world = glObj.getWorld(); |
1331 | switch (glObj.geomType()) | 1332 | |
1333 | var nearVrt = glObj.getNearVertex( eyePt, dir ); | ||
1334 | if (nearVrt) | ||
1332 | { | 1335 | { |
1333 | case glObj.GEOM_TY |