aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/canvas-runtime.js20
-rwxr-xr-xjs/controllers/elements/shapes-controller.js371
-rwxr-xr-xjs/data/pi/pi-data.js2
-rwxr-xr-xjs/document/html-document.js11
-rwxr-xr-xjs/document/templates/montage-html/default_html.css4
-rwxr-xr-xjs/lib/NJUtils.js4
-rwxr-xr-xjs/lib/drawing/world.js2
-rwxr-xr-xjs/lib/geom/circle.js19
-rwxr-xr-xjs/lib/geom/geom-obj.js388
-rwxr-xr-xjs/lib/geom/line.js10
-rwxr-xr-xjs/lib/geom/rectangle.js15
-rwxr-xr-xjs/mediators/element-mediator.js24
-rwxr-xr-xjs/models/color-model.js56
-rwxr-xr-xjs/models/shape-model.js7
-rwxr-xr-xjs/panels/Splitter.js2
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/css/TimelinePanel.css4
-rw-r--r--js/panels/presets/default-animation-presets.js2
-rw-r--r--js/panels/presets/default-style-presets.js11
-rw-r--r--js/panels/presets/default-transition-presets.js8
-rw-r--r--js/panels/presets/transitions-presets.reel/transitions-presets.js4
-rw-r--r--js/panels/resize-composer.js34
-rwxr-xr-xjs/stage/tool-handle.js7
-rwxr-xr-xjs/tools/FillTool.js20
-rwxr-xr-xjs/tools/InkBottleTool.js21
-rwxr-xr-xjs/tools/LineTool.js9
-rwxr-xr-xjs/tools/OvalTool.js15
-rwxr-xr-xjs/tools/RectTool.js15
-rwxr-xr-xjs/tools/SelectionTool.js1
-rwxr-xr-xjs/tools/ShapeTool.js13
-rwxr-xr-xjs/tools/Translate3DToolBase.js25
-rwxr-xr-xjs/tools/TranslateObject3DTool.js23
-rwxr-xr-xjs/tools/modifier-tool-base.js26
32 files changed, 700 insertions, 473 deletions
diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js
index a35f473d..2ca76962 100644
--- a/assets/canvas-runtime.js
+++ b/assets/canvas-runtime.js
@@ -121,13 +121,13 @@ NinjaCvsRt.GLRuntime = function ( canvas, jObj, assetPath )
121 // all "live" materials 121 // all "live" materials
122 this._materials = []; 122 this._materials = [];
123 123
124 // provide the mapping for the asset directory 124 // provide the mapping for the asset directory
125 if (assetPath) 125 if (assetPath)
126 { 126 {
127 this._assetPath = assetPath.slice(); 127 this._assetPath = assetPath.slice();
128 if (this._assetPath[this._assetPath.length-1] != '/') 128 if (this._assetPath[this._assetPath.length-1] != '/')
129 this._assetPath += '/'; 129 this._assetPath += '/';
130 } 130 }
131 131
132 if(this._assetPath !== undefined) { 132 if(this._assetPath !== undefined) {
133 RDGE.globals.engine.setAssetPath(this._assetPath); 133 RDGE.globals.engine.setAssetPath(this._assetPath);
@@ -638,7 +638,7 @@ NinjaCvsRt.RuntimeGeomObj = function ()
638 638
639 return mat; 639 return mat;
640 }; 640 };
641 641
642 this.MatrixRotationZ = function( angle ) 642 this.MatrixRotationZ = function( angle )
643 { 643 {
644 var mat = this.MatrixIdentity(4); 644 var mat = this.MatrixIdentity(4);
@@ -998,7 +998,7 @@ NinjaCvsRt.RuntimeOval = function ()
998 mat[5] = yScale; 998 mat[5] = yScale;
999 999
1000 // get the bezier points 1000 // get the bezier points
1001 var bezPtsInside = this.circularArcToBezier( Vector.create([0,0,0]), Vector.create([1,0,0]), -2.0*Math.PI ); 1001 var bezPtsInside = this.circularArcToBezier( [0,0,0], [1,0,0], -2.0*Math.PI );
1002 if (bezPtsInside) 1002 if (bezPtsInside)
1003 { 1003 {
1004 n = bezPtsInside.length; 1004 n = bezPtsInside.length;
@@ -1465,7 +1465,7 @@ NinjaCvsRt.RuntimeUberMaterial = function ()
1465 // currently not exported 1465 // currently not exported
1466 var uvTransform = [ 2.0, 0, 0, 0, 0, 2.0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1]; 1466 var uvTransform = [ 2.0, 0, 0, 0, 0, 2.0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1];
1467 technique.u_uvMatrix.set(uvTransform); 1467 technique.u_uvMatrix.set(uvTransform);
1468 1468
1469 var tex = null; 1469 var tex = null;
1470 if (this._diffuseMap) 1470 if (this._diffuseMap)
1471 { 1471 {
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index e792c646..f9b63942 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -13,12 +13,62 @@ var Montage = require("montage/core/core").Montage,
13exports.ShapesController = Montage.create(CanvasController, { 13exports.ShapesController = Montage.create(CanvasController, {
14 14
15 setProperty: { 15 setProperty: {
16 value: function(el, p, value) { 16 value: function(el, p, value, eventType, source) {
17 var val = parseInt(value); 17 var val = parseInt(value),
18 canvas,
19 m,
20 color;
18 switch(p) { 21 switch(p) {
19 case "strokeSize": 22 case "strokeSize":
20 // TODO - For now, just handling px units. 23 // TODO - For now, just handling px units.
21 this.setShapeProperty(el, "strokeSize", value); 24 this.setShapeProperty(el, "strokeSize", value);
25 // Changing stroke size should grow/shrink the shape from the center.
26 var delta = ~~(val - el.elementModel.shapeModel.GLGeomObj.getStrokeWidth()),
27 l = this.application.ninja.elementMediator.getProperty(el, "left", parseInt),
28 t = this.application.ninja.elementMediator.getProperty(el, "top", parseInt),
29 w = this.application.ninja.elementMediator.getProperty(el, "width", parseInt),
30 h = this.application.ninja.elementMediator.getProperty(el, "height", parseInt);
31
32 if(el.elementModel.selection === "Line")
33 {
34 var slope = el.elementModel.shapeModel.slope;
35 // set the dimensions
36 if(slope === "horizontal")
37 {
38 h = Math.max(val, 1);
39 }
40 else if(slope === "vertical")
41 {
42 w = Math.max(val, 1);
43 }
44 else
45 {
46 var oldXAdj = el.elementModel.shapeModel.GLGeomObj.getXAdj();
47 var oldYAdj = el.elementModel.shapeModel.GLGeomObj.getYAdj();
48 var theta = Math.atan(el.elementModel.shapeModel.slope);
49 var xAdj = Math.abs((val/2)*Math.sin(theta));
50 var yAdj = Math.abs((val/2)*Math.cos(theta));
51 var dX = ~~(xAdj*2 - oldXAdj*2);
52 var dY = ~~(yAdj*2 - oldYAdj*2);
53
54 if(delta > 0)
55 {
56 l -= dX*2;
57 t -= dY*2;
58 w += dX*2;
59 h += dY*2;
60 }
61
62 el.elementModel.shapeModel.GLGeomObj.setXAdj(xAdj);
63 el.elementModel.shapeModel.GLGeomObj.setYAdj(yAdj);
64
65 }
66 }
67 this.application.ninja.elementMediator.setProperties([el],
68 { "left": [l + "px"],
69 "top": [t + "px"],
70 "width": [w + "px"],
71 "height": [h + "px"] }, eventType, source );
22 el.elementModel.shapeModel.GLGeomObj.setStrokeWidth(val); 72 el.elementModel.shapeModel.GLGeomObj.setStrokeWidth(val);
23 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 73 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
24 el.elementModel.shapeModel.GLWorld.render(); 74 el.elementModel.shapeModel.GLWorld.render();
@@ -68,39 +118,47 @@ exports.ShapesController = Montage.create(CanvasController, {
68 el.elementModel.shapeModel.GLWorld.render(); 118 el.elementModel.shapeModel.GLWorld.render();
69 break; 119 break;
70 case "useWebGl": 120 case "useWebGl":
71 var canvas = njModule.NJUtils.makeNJElement("canvas", "Canvas", "shape", el.className, true); 121 canvas = njModule.NJUtils.makeNJElement("canvas", "Canvas", "shape", el.className, true);
72 canvas.setAttribute("data-RDGE-id", njModule.NJUtils.generateRandom()); 122 canvas.setAttribute("data-RDGE-id", njModule.NJUtils.generateRandom());
73 canvas.width = el.width; 123 canvas.width = el.width;
74 canvas.height = el.height; 124 canvas.height = el.height;
75 canvas.elementModel = el.elementModel; 125 canvas.elementModel = el.elementModel;
76 this.toggleWebGlMode(canvas, value); 126 this.toggleWebGlMode(canvas, value);
77 this.application.ninja.elementMediator.replaceElement(canvas, el); 127 this.application.ninja.elementMediator.replaceElement(canvas, el);
78 return; 128 break;
79 case "strokeMaterial": 129 case "strokeMaterial":
80 var sm = Object.create(MaterialsModel.getMaterial(value)); 130 m = Object.create(MaterialsModel.getMaterial(value));
81 if(sm) 131 if(m)
82 { 132 {
83 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(sm); 133 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(m);
84 el.elementModel.shapeModel.strokeMaterial = sm; 134 color = this.getMaterialColor(value);
135 if(color)
136 {
137 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(color);
138 }
85 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 139 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
86 el.elementModel.shapeModel.GLWorld.render(); 140 el.elementModel.shapeModel.GLWorld.render();
87 } 141 }
88 break; 142 break;
89 case "fillMaterial": 143 case "fillMaterial":
90 var fm = Object.create(MaterialsModel.getMaterial(value)); 144 m = Object.create(MaterialsModel.getMaterial(value));
91 if(fm) 145 if(m)
92 { 146 {
93 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(fm); 147 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(m);
94 el.elementModel.shapeModel.fillMaterial = fm;