aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-11 22:33:26 -0800
committerJose Antonio Marquez2012-02-11 22:33:26 -0800
commitc6ed3331e88eb01a52ac533e5449df3af2fb5965 (patch)
tree2b660dc94a98bad02b46ba44a28424d692435fb3 /js/controllers
parent5d38e575b2bafeae9bd676247fce15ec5f78fa32 (diff)
parente142611e22718b1f1d1696902ad9161ec5f33f98 (diff)
downloadninja-c6ed3331e88eb01a52ac533e5449df3af2fb5965.tar.gz
Merge branch 'refs/heads/NinjaInternal' into Color
Diffstat (limited to 'js/controllers')
-rw-r--r--js/controllers/elements/shapes-controller.js36
-rw-r--r--js/controllers/main-menu-controller.js43
-rw-r--r--js/controllers/styles-controller.js4
3 files changed, 78 insertions, 5 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 39300eb8..f69e6fc9 100644
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -43,11 +43,11 @@ exports.ShapesController = Montage.create(CanvasController, {
43 canvas.height = el.height; 43 canvas.height = el.height;
44 this.application.ninja.elementMediator.replaceElement(el, canvas); 44 this.application.ninja.elementMediator.replaceElement(el, canvas);
45 NJevent("elementDeleted", el); 45 NJevent("elementDeleted", el);
46 this.application.ninja.selectionController.selectElement(canvas);
47 el = canvas; 46 el = canvas;
48 this.toggleWebGlMode(el, value); 47 this.toggleWebGlMode(el, value);
49 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 48 el.elementModel.shapeModel.GLWorld.render();
50 break; 49 this.application.ninja.selectionController.selectElement(el);
50 return;
51 case "strokeMaterial": 51 case "strokeMaterial":
52 var sm = Object.create(MaterialsLibrary.getMaterial(value)); 52 var sm = Object.create(MaterialsLibrary.getMaterial(value));
53 if(sm) 53 if(sm)
@@ -318,7 +318,9 @@ exports.ShapesController = Montage.create(CanvasController, {
318 { 318 {
319 return; 319 return;
320 } 320 }
321 var world, 321 var sm,
322 fm,
323 world,
322 worldData = el.elementModel.shapeModel.GLWorld.export(); 324 worldData = el.elementModel.shapeModel.GLWorld.export();
323 if(worldData) 325 if(worldData)
324 { 326 {
@@ -326,6 +328,22 @@ exports.ShapesController = Montage.create(CanvasController, {
326 el.elementModel.shapeModel.GLWorld = world; 328 el.elementModel.shapeModel.GLWorld = world;
327 el.elementModel.shapeModel.useWebGl = true; 329 el.elementModel.shapeModel.useWebGl = true;
328 world.import(worldData); 330 world.import(worldData);
331 el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot();
332
333 sm = Object.create(MaterialsLibrary.getMaterial("FlatMaterial"));
334 if(sm)
335 {
336 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(sm);
337 el.elementModel.shapeModel.strokeMaterial = sm;
338 }
339 fm = Object.create(MaterialsLibrary.getMaterial("FlatMaterial"));
340 // TODO - Use consts after GL code is converted to object literal notation
341// if( fm && (el.elementModel.shapeModel.GLGeomObj.geomType() !== GLGeomObj.GEOM_TYPE_LINE) )
342 if( fm && (el.elementModel.shapeModel.GLGeomObj.geomType() !== 3) )
343 {
344 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(fm);
345 el.elementModel.shapeModel.fillMaterial = fm;
346 }
329 } 347 }
330 348
331 } 349 }
@@ -346,8 +364,16 @@ exports.ShapesController = Montage.create(CanvasController, {
346 el.elementModel.shapeModel.GLWorld = world; 364 el.elementModel.shapeModel.GLWorld = world;
347 el.elementModel.shapeModel.useWebGl = false; 365 el.elementModel.shapeModel.useWebGl = false;
348 world.import(worldData); 366 world.import(worldData);
367 el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot();
368 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(null);
369 el.elementModel.shapeModel.strokeMaterial = null;
370 // TODO - Use consts after GL code is converted to object literal notation
371 if(el.elementModel.shapeModel.GLGeomObj.geomType() !== 3)
372 {
373 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(null);
374 el.elementModel.shapeModel.fillMaterial = null;
375 }
349 } 376 }
350
351 } 377 }
352 } 378 }
353 379
diff --git a/js/controllers/main-menu-controller.js b/js/controllers/main-menu-controller.js
new file mode 100644
index 00000000..5e126617
--- /dev/null
+++ b/js/controllers/main-menu-controller.js
@@ -0,0 +1,43 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7
8var Montage = require("montage/core/core").Montage,
9 Component = require("montage/ui/component").Component;
10
11exports.MainMenuController = Montage.create(Component, {
12 deserializedFromTemplate:{
13 value:function () {
14 this.eventManager.addEventListener("executeHelpFAQ", this, false);
15 this.eventManager.addEventListener("executeHelpForums", this, false);
16 this.eventManager.addEventListener("executeHelpTopics", this, false);
17 this.eventManager.addEventListener("executeHelpAbout", this, false);
18 }
19 },
20
21 // Basic help menu handling methods
22 handleExecuteHelpFAQ:{
23 value:function () {
24 window.open('http://www.tetsubo.org/go/ninjafaq');
25 }
26 },
27 handleExecuteHelpForums:{
28 value:function () {
29 window.open('http://www.tetsubo.org/go/ninjaforums');
30 }
31 },
32 handleExecuteHelpTopics:{
33 value:function () {
34 window.open('http://www.tetsubo.org/go/ninjadocs');
35 }
36 },
37 handleExecuteHelpAbout:{
38 value:function () {
39 // TODO
40 console.log("Pull up the about popup");
41 }
42 }
43});
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js
index 011caec5..44e0e798 100644
--- a/js/controllers/styles-controller.js
+++ b/js/controllers/styles-controller.js
@@ -181,6 +181,10 @@ var stylesController = exports.StylesController = Montage.create(Component, {
181 rule = stylesheet.rules[index]; 181 rule = stylesheet.rules[index];
182 182
183 ///// attach specificity to rule object 183 ///// attach specificity to rule object
184 // if rule is css keyframes, return rule and don't attach specificity
185 if (rule instanceof WebKitCSSKeyframesRule) {
186 return rule;
187 }
184 rule[this.CONST.SPECIFICITY_KEY] = this.getSpecificity(rule.selectorText); 188 rule[this.CONST.SPECIFICITY_KEY] = this.getSpecificity(rule.selectorText);
185 189
186 ///// return the rule we just inserted 190 ///// return the rule we just inserted