aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-03-30 11:04:47 -0700
committerNivesh Rajbhandari2012-03-30 11:04:47 -0700
commit80782d5d0721463f716f0a7241afd09a38543199 (patch)
tree2dfb0531f2498afcad5afe95f8e338d0f1d34161 /js/controllers
parent5b4f6b1618cf571a6bce5a631f976a008e04a64e (diff)
parentf4949cab544886702e7ad6eeaa6215125c7b067a (diff)
downloadninja-80782d5d0721463f716f0a7241afd09a38543199.tar.gz
Merge branch 'refs/heads/ninja-internal' into WebGLFileIO
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/elements/shapes-controller.js92
1 files changed, 77 insertions, 15 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 45b822e2..a4d53e50 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -117,6 +117,31 @@ exports.ShapesController = Montage.create(CanvasController, {
117 el.elementModel.shapeModel.GLWorld._canvas.task.stop(); 117 el.elementModel.shapeModel.GLWorld._canvas.task.stop();
118 } 118 }
119 break; 119 break;
120 case "strokeHardness":
121 this.setShapeProperty(el, "strokeHardness", value);
122 el.elementModel.shapeModel.GLGeomObj.setStrokeHardness(val);
123 el.elementModel.shapeModel.GLWorld.render();
124 break;
125 case "strokeSmoothing":
126 this.setShapeProperty(el, "strokeSmoothing", value);
127 el.elementModel.shapeModel.GLGeomObj.setSmoothingAmount(val);
128 el.elementModel.shapeModel.GLWorld.render();
129 break;
130 case "doSmoothing":
131 this.setShapeProperty(el, "doSmoothing", value);
132 el.elementModel.shapeModel.GLGeomObj.setDoSmoothing(value);
133 el.elementModel.shapeModel.GLWorld.render();
134 break;
135 case "isCalligraphic":
136 this.setShapeProperty(el, "isCalligraphic", value);
137 el.elementModel.shapeModel.GLGeomObj.setStrokeUseCalligraphic(value);
138 el.elementModel.shapeModel.GLWorld.render();
139 break;
140 case "strokeAngle":
141 this.setShapeProperty(el, "strokeAngle", value);
142 el.elementModel.shapeModel.GLGeomObj.setStrokeAngle(Math.PI * val/180);
143 el.elementModel.shapeModel.GLWorld.render();
144 break;
120 default: 145 default:
121 CanvasController.setProperty(el, p, value); 146 CanvasController.setProperty(el, p, value);
122 } 147 }
@@ -139,6 +164,43 @@ exports.ShapesController = Montage.create(CanvasController, {
139 return this.getColor(el, false); 164 return this.getColor(el, false);
140 case "background": 165 case "background":
141 return this.getColor(el, true); 166 return this.getColor(el, true);
167 case "strokeHardness":
168 if (el.elementModel && el.elementModel.shapeModel){
169 return el.elementModel.shapeModel.GLGeomObj.getStrokeHardness();
170 } else {
171 return null;
172 }
173 break;
174 case "doSmoothing":
175 if (el.elementModel && el.elementModel.shapeModel){
176 return el.elementModel.shapeModel.GLGeomObj.getDoSmoothing();
177 } else {
178 return null;
179 }
180 break;
181 case "strokeSmoothing":
182 if (el.elementModel && el.elementModel.shapeModel){
183 return el.elementModel.shapeModel.GLGeomObj.getSmoothingAmount();
184 } else {
185 return null;
186 }
187 break;
188 case "isCalligraphic":
189 if (el.elementModel && el.elementModel.shapeModel){
190 return el.elementModel.shapeModel.GLGeomObj.getStrokeUseCalligraphic();
191 } else {
192 return null;
193 }
194 break;
195 case "strokeAngle":
196 if (el.elementModel && el.elementModel.shapeModel){
197 return 180*el.elementModel.shapeModel.GLGeomObj.getStrokeAngle()/Math.PI;
198 } else {
199 return null;
200 }
201 break;
202
203
142 case "strokeMaterial": 204 case "strokeMaterial":
143 var sm = el.elementModel.shapeModel.GLGeomObj.getStrokeMaterial(); 205 var sm = el.elementModel.shapeModel.GLGeomObj.getStrokeMaterial();
144 if(sm) 206 if(sm)
@@ -270,8 +332,8 @@ exports.ShapesController = Montage.create(CanvasController, {
270 { 332 {
271 return this.application.ninja.colorController.colorModel.webGlToColor(el.elementModel.shapeModel.GLGeomObj.getFillColor()); 333 return this.application.ninja.colorController.colorModel.webGlToColor(el.elementModel.shapeModel.GLGeomObj.getFillColor());
272 } 334 }
273 else 335 else
274 { 336 {
275 return null; 337 return null;
276 } 338 }
277 } 339 }
@@ -300,7 +362,7 @@ exports.ShapesController = Montage.create(CanvasController, {
300 if( !m || (m.getName() !== "RadialGradientMaterial") ) 362 if( !m || (m.getName() !== "RadialGradientMaterial") )
301 { 363 {
302 gradientM = Object.create(MaterialsModel.getMaterial("RadialGradientMaterial")); 364 gradientM = Object.create(MaterialsModel.getMaterial("RadialGradientMaterial"));
303 } 365 }
304 } 366 }
305 else 367 else
306 { 368 {
@@ -312,17 +374,17 @@ exports.ShapesController = Montage.create(CanvasController, {
312 374
313 if(gradientM) 375 if(gradientM)
314 { 376 {
315 if(isFill) 377 if(isFill)
316 { 378 {
317 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(gradientM); 379 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(gradientM);
318 } 380 }
319 else 381 else
320 { 382 {
321 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(gradientM); 383 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(gradientM);
322 } 384 }
323 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 385 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
324 } 386 }
325 } 387 }
326 }, 388 },
327 389
328 _setFlatMaterial: { 390 _setFlatMaterial: {
@@ -339,10 +401,10 @@ exports.ShapesController = Montage.create(CanvasController, {
339 } 401 }
340 402
341 if(!m || ((m.getName() === "LinearGradientMaterial") || m.getName() === "RadialGradientMaterial") ) 403 if(!m || ((m.getName() === "LinearGradientMaterial") || m.getName() === "RadialGradientMaterial") )
342 { 404 {
343 flatM = Object.create(MaterialsModel.getMaterial("FlatMaterial")); 405 flatM = Object.create(MaterialsModel.getMaterial("FlatMaterial"));
344 if(flatM) 406 if(flatM)
345 { 407 {
346 if(isFill) 408 if(isFill)
347 { 409 {
348 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(flatM); 410 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(flatM);
@@ -351,10 +413,10 @@ exports.ShapesController = Montage.create(CanvasController, {
351 { 413 {
352 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(flatM); 414 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(flatM);
353 } 415 }
354 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 416 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
417 }
355 } 418 }
356 } 419 }
357 }
358 }, 420 },
359 421
360 setColor: { 422 setColor: {
@@ -513,7 +575,7 @@ exports.ShapesController = Montage.create(CanvasController, {
513 el.elementModel.shapeModel.useWebGl = true; 575 el.elementModel.shapeModel.useWebGl = true;
514 world.importJSON(worldData); 576 world.importJSON(worldData);
515 el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot(); 577 el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot();
516 } 578 }
517 579
518 } 580 }
519 }, 581 },
@@ -535,8 +597,8 @@ exports.ShapesController = Montage.create(CanvasController, {
535 el.elementModel.shapeModel.useWebGl = false; 597 el.elementModel.shapeModel.useWebGl = false;
536 world.importJSON(worldData); 598 world.importJSON(worldData);
537 el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot(); 599 el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot();
600 }
538 } 601 }
539 }
540 }, 602 },
541 603
542 flip3DSense: { 604 flip3DSense: {
@@ -567,7 +629,7 @@ exports.ShapesController = Montage.create(CanvasController, {
567 if(child.strokeColor.gradientMode === "radial") 629 if(child.strokeColor.gradientMode === "radial")
568 { 630 {
569 child.strokeMat = "RadialGradientMaterial"; 631 child.strokeMat = "RadialGradientMaterial";
570 } 632 }
571 else 633 else
572 { 634 {
573 child.strokeMat = "LinearGradientMaterial"; 635 child.strokeMat = "LinearGradientMaterial";