aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-29 15:04:36 -0800
committerValerio Virgillito2012-02-29 15:04:36 -0800
commitb09956e4a9a35c5588cc7cd1f01efb617cbe0884 (patch)
tree49b07dfb52252ac986c567ad5c3a7c39ebcc86e2 /js/controllers
parent551e1f2be11e9e6ab7af17816396b88aafd57dff (diff)
parent2b9f63089534356607ad7e0ddde6f22e42d04f80 (diff)
downloadninja-b09956e4a9a35c5588cc7cd1f01efb617cbe0884.tar.gz
Merge branch 'refs/heads/integration-candidate'
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/document-controller.js6
-rwxr-xr-xjs/controllers/elements/shapes-controller.js11
-rwxr-xr-xjs/controllers/selection-controller.js13
3 files changed, 28 insertions, 2 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 02031922..64ff2c7e 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -195,7 +195,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
195 value:function(doc){ 195 value:function(doc){
196 var response = doc || null;//default just for testing 196 var response = doc || null;//default just for testing
197 if(!!response && response.success && (response.status!== 500) && !!response.uri){ 197 if(!!response && response.success && (response.status!== 500) && !!response.uri){
198
199 this.isNewFilePath = true;//path identifier flag
198 this.creatingNewFile = true;//flag for timeline to identify new file flow 200 this.creatingNewFile = true;//flag for timeline to identify new file flow
201
199 this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this)); 202 this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this));
200 }else if(!!response && !response.success){ 203 }else if(!!response && !response.success){
201 //Todo: restrict directory path to the sandbox, in the dialog itself 204 //Todo: restrict directory path to the sandbox, in the dialog itself
@@ -224,9 +227,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
224 //TODO: Add UI to handle error codes, shouldn't be alert windows 227 //TODO: Add UI to handle error codes, shouldn't be alert windows
225 if(!!response && (response.status === 204)) { 228 if(!!response && (response.status === 204)) {
226 229
227 if((typeof this.creatingNewFile === 'undefined') || (this.creatingNewFile !== true)){//not from new file flow 230 if((typeof this.isNewFilePath === 'undefined') || (this.isNewFilePath !== true)){//not from new file flow
228 this.creatingNewFile = false; 231 this.creatingNewFile = false;
229 } 232 }
233 this.isNewFilePath = false;//reset path identifier flag
230 234
231 //Sending full response object 235 //Sending full response object
232 this.openDocument(response); 236 this.openDocument(response);
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index e0bff70c..749a1dd9 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -19,43 +19,51 @@ exports.ShapesController = Montage.create(CanvasController, {
19 this.setShapeProperty(el, "strokeSize", value); 19 this.setShapeProperty(el, "strokeSize", value);
20 el.elementModel.shapeModel.GLGeomObj.setStrokeWidth(val); 20 el.elementModel.shapeModel.GLGeomObj.setStrokeWidth(val);
21 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 21 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
22 el.elementModel.shapeModel.GLWorld.render();
22 break; 23 break;
23 case "innerRadius": 24 case "innerRadius":
24 this.setShapeProperty(el, "innerRadius", value); 25 this.setShapeProperty(el, "innerRadius", value);
25 el.elementModel.shapeModel.GLGeomObj.setInnerRadius(val/100); 26 el.elementModel.shapeModel.GLGeomObj.setInnerRadius(val/100);
26 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 27 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
28 el.elementModel.shapeModel.GLWorld.render();
27 break; 29 break;
28 case "tlRadius": 30 case "tlRadius":
29 this.setShapeProperty(el, "tlRadius", value); 31 this.setShapeProperty(el, "tlRadius", value);
30 el.elementModel.shapeModel.GLGeomObj.setTLRadius(val); 32 el.elementModel.shapeModel.GLGeomObj.setTLRadius(val);
31 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 33 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
34 el.elementModel.shapeModel.GLWorld.render();
32 break; 35 break;
33 case "trRadius": 36 case "trRadius":
34 this.setShapeProperty(el, "trRadius", value); 37 this.setShapeProperty(el, "trRadius", value);
35 el.elementModel.shapeModel.GLGeomObj.setTRRadius(val); 38 el.elementModel.shapeModel.GLGeomObj.setTRRadius(val);
36 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 39 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
40 el.elementModel.shapeModel.GLWorld.render();
37 break; 41 break;
38 case "blRadius": 42 case "blRadius":
39 this.setShapeProperty(el, "blRadius", value); 43 this.setShapeProperty(el, "blRadius", value);
40 el.elementModel.shapeModel.GLGeomObj.setBLRadius(val); 44 el.elementModel.shapeModel.GLGeomObj.setBLRadius(val);
41 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 45 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
46 el.elementModel.shapeModel.GLWorld.render();
42 break; 47 break;
43 case "brRadius": 48 case "brRadius":
44 this.setShapeProperty(el, "brRadius", value); 49 this.setShapeProperty(el, "brRadius", value);
45 el.elementModel.shapeModel.GLGeomObj.setBRRadius(val); 50 el.elementModel.shapeModel.GLGeomObj.setBRRadius(val);
46 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 51 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
52 el.elementModel.shapeModel.GLWorld.render();
47 break; 53 break;
48 case "width": 54 case "width":
49 el.elementModel.shapeModel.GLGeomObj.setWidth(val); 55 el.elementModel.shapeModel.GLGeomObj.setWidth(val);
50 CanvasController.setProperty(el, p, value); 56 CanvasController.setProperty(el, p, value);
51 el.elementModel.shapeModel.GLWorld.setViewportFromCanvas(el); 57 el.elementModel.shapeModel.GLWorld.setViewportFromCanvas(el);
52 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 58 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
59 el.elementModel.shapeModel.GLWorld.render();
53 break; 60 break;
54 case "height": 61 case "height":
55 el.elementModel.shapeModel.GLGeomObj.setHeight(val); 62 el.elementModel.shapeModel.GLGeomObj.setHeight(val);
56 CanvasController.setProperty(el, p, value); 63 CanvasController.setProperty(el, p, value);
57 el.elementModel.shapeModel.GLWorld.setViewportFromCanvas(el); 64 el.elementModel.shapeModel.GLWorld.setViewportFromCanvas(el);
58 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 65 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
66 el.elementModel.shapeModel.GLWorld.render();
59 break; 67 break;
60 case "useWebGl": 68 case "useWebGl":
61 var canvas = njModule.NJUtils.makeNJElement("canvas", "Canvas", "shape", el.className, true); 69 var canvas = njModule.NJUtils.makeNJElement("canvas", "Canvas", "shape", el.className, true);
@@ -76,6 +84,7 @@ exports.ShapesController = Montage.create(CanvasController, {
76 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(sm); 84 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(sm);
77 el.elementModel.shapeModel.strokeMaterial = sm; 85 el.elementModel.shapeModel.strokeMaterial = sm;
78 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 86 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
87 el.elementModel.shapeModel.GLWorld.render();
79 } 88 }
80 break; 89 break;
81 case "fillMaterial": 90 case "fillMaterial":
@@ -85,12 +94,12 @@ exports.ShapesController = Montage.create(CanvasController, {
85 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(fm); 94 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(fm);
86 el.elementModel.shapeModel.fillMaterial = fm; 95 el.elementModel.shapeModel.fillMaterial = fm;
87 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 96 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
97 el.elementModel.shapeModel.GLWorld.render();
88 } 98 }
89 break; 99 break;
90 default: 100 default:
91 CanvasController.setProperty(el, p, value); 101 CanvasController.setProperty(el, p, value);
92 } 102 }
93 el.elementModel.shapeModel.GLWorld.render();
94 } 103 }
95 }, 104 },
96 105
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index f50762f3..c4623d3f 100755
--- a/js/controllers/selection-controller.js
+++ b/js/controllers/selection-controller.js
@@ -47,6 +47,7 @@ exports.SelectionController = Montage.create(Component, {
47 this.eventManager.addEventListener("elementDeleted", this, false); 47 this.eventManager.addEventListener("elementDeleted", this, false);
48 this.eventManager.addEventListener("selectAll", this, false); 48 this.eventManager.addEventListener("selectAll", this, false);
49 this.eventManager.addEventListener("deleteSelection", this, false); 49 this.eventManager.addEventListener("deleteSelection", this, false);
50 this.eventManager.addEventListener("switchDocument", this, false);
50// defaultEventManager.addEventListener( "undo", this, false); 51// defaultEventManager.addEventListener( "undo", this, false);
51// defaultEventManager.addEventListener( "redo", this, false); 52// defaultEventManager.addEventListener( "redo", this, false);
52 } 53 }
@@ -88,6 +89,18 @@ exports.SelectionController = Montage.create(Component, {
88 } 89 }
89 }, 90 },
90 91
92 handleSwitchDocument: {
93 value: function() {
94 this._selectedItems = this.application.ninja.selectedElements.slice(0);
95 if(this._selectedItems.length === 0 ){
96 this._isDocument = true;
97 }else{
98 this._isDocument = false;
99 }
100 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} );
101 }
102 },
103
91 handleElementAdded: { 104 handleElementAdded: {
92 value: function(event) { 105 value: function(event) {
93 this.executeSelectElement(event.detail); 106 this.executeSelectElement(event.detail);