diff options
author | Pushkar Joshi | 2012-04-27 15:05:38 -0700 |
---|---|---|
committer | Pushkar Joshi | 2012-04-27 15:05:38 -0700 |
commit | c8fc8e1bd1c394f433b4fc1677f4bc596e7cc2cc (patch) | |
tree | 74fcb9818a917d4f8ddb0db0c78a8cff9af86339 /js/controllers | |
parent | 28d1594b868e3c08e5603adbd5b29df1e24d57e9 (diff) | |
parent | c8fac64d4ad8ac18744a17a5e0f0d17204355fd6 (diff) | |
download | ninja-c8fc8e1bd1c394f433b4fc1677f4bc596e7cc2cc.tar.gz |
Merge branch 'master' into pentool
Diffstat (limited to 'js/controllers')
-rwxr-xr-x | js/controllers/elements/body-controller.js | 44 | ||||
-rwxr-xr-x | js/controllers/elements/controller-factory.js | 5 | ||||
-rwxr-xr-x | js/controllers/elements/element-controller.js | 16 | ||||
-rwxr-xr-x | js/controllers/elements/shapes-controller.js | 20 | ||||
-rwxr-xr-x | js/controllers/elements/stage-controller.js | 2 |
5 files changed, 70 insertions, 17 deletions
diff --git a/js/controllers/elements/body-controller.js b/js/controllers/elements/body-controller.js new file mode 100755 index 00000000..fbbb7c6e --- /dev/null +++ b/js/controllers/elements/body-controller.js | |||
@@ -0,0 +1,44 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No 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 | var Montage = require("montage/core/core").Montage, | ||
8 | ElementController = require("js/controllers/elements/element-controller").ElementController; | ||
9 | |||
10 | exports.BodyController = Montage.create(ElementController, { | ||
11 | |||
12 | // TODO - perspective distance needs to be passed in as "dist" and matrix3d needs to be passed in as "mat" | ||
13 | set3DProperties: { | ||
14 | value: function(el, props, update3DModel) { | ||
15 | } | ||
16 | }, | ||
17 | |||
18 | getProperty: { | ||
19 | value: function(el, p) { | ||
20 | } | ||
21 | }, | ||
22 | |||
23 | setProperty: { | ||
24 | value: function(el, p, value) { | ||
25 | } | ||
26 | }, | ||
27 | |||
28 | setAttribute: { | ||
29 | value: function(el, att, value) { | ||
30 | } | ||
31 | }, | ||
32 | |||
33 | getPerspectiveDist: { | ||
34 | value: function(el) { | ||
35 | if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) { | ||
36 | return el.elementModel.props3D.perspectiveDist; | ||
37 | } else { | ||
38 | var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, true); | ||
39 | el.elementModel.props3D.perspectiveDist = dist; | ||
40 | return dist; | ||
41 | } | ||
42 | } | ||
43 | } | ||
44 | }); | ||
diff --git a/js/controllers/elements/controller-factory.js b/js/controllers/elements/controller-factory.js index a772eb16..1bbbbce0 100755 --- a/js/controllers/elements/controller-factory.js +++ b/js/controllers/elements/controller-factory.js | |||
@@ -6,7 +6,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
6 | 6 | ||
7 | var Montage = require("montage/core/core").Montage; | 7 | var Montage = require("montage/core/core").Montage; |
8 | 8 | ||
9 | var BlockController = require("js/controllers/elements/block-controller").BlockController, | 9 | var BodyController = require("js/controllers/elements/body-controller").BodyController, |
10 | BlockController = require("js/controllers/elements/block-controller").BlockController, | ||
10 | StageController = require("js/controllers/elements/stage-controller").StageController, | 11 | StageController = require("js/controllers/elements/stage-controller").StageController, |
11 | ShapesController = require("js/controllers/elements/shapes-controller").ShapesController, | 12 | ShapesController = require("js/controllers/elements/shapes-controller").ShapesController, |
12 | ImageController = require("js/controllers/elements/image-controller").ImageController, | 13 | ImageController = require("js/controllers/elements/image-controller").ImageController, |
@@ -27,6 +28,8 @@ exports.ControllerFactory = Montage.create(Montage, { | |||
27 | return BlockController; | 28 | return BlockController; |
28 | } else if(value.indexOf("stage") !== -1) { | 29 | } else if(value.indexOf("stage") !== -1) { |
29 | return StageController; | 30 | return StageController; |
31 | } else if(value.indexOf("body") !== -1) { | ||
32 | return BodyController; | ||
30 | } else if(value.indexOf("shape") !== -1) { | 33 | } else if(value.indexOf("shape") !== -1) { |
31 | return ShapesController; | 34 | return ShapesController; |
32 | } else if(value.indexOf("canvas") !== -1) { | 35 | } else if(value.indexOf("canvas") !== -1) { |
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 35a543ac..452d09f1 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js | |||
@@ -152,16 +152,24 @@ exports.ElementController = Montage.create(Component, { | |||
152 | this.setProperty(el, "border-image", color.color.css); | 152 | this.setProperty(el, "border-image", color.color.css); |
153 | this.setProperty(el, "border-color", "none"); | 153 | this.setProperty(el, "border-color", "none"); |
154 | if(color.borderInfo) { | 154 | if(color.borderInfo) { |
155 | this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits); | 155 | if(color.borderInfo.borderWidth) { |
156 | this.setProperty(el, "border-style", color.borderInfo.borderStyle); | 156 | this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits); |
157 | } | ||
158 | if(color.borderInfo.borderStyle) { | ||
159 | this.setProperty(el, "border-style", color.borderInfo.borderStyle); | ||
160 | } | ||
157 | } | 161 | } |
158 | break; | 162 | break; |
159 | default: | 163 | default: |
160 | this.setProperty(el, "border-image", "none"); | 164 | this.setProperty(el, "border-image", "none"); |
161 | this.setProperty(el, "border-color", color.color.css); | 165 | this.setProperty(el, "border-color", color.color.css); |
162 | if(color.borderInfo) { | 166 | if(color.borderInfo) { |
163 | this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits); | 167 | if(color.borderInfo.borderWidth) { |
164 | this.setProperty(el, "border-style", color.borderInfo.borderStyle); | 168 | this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits); |
169 | } | ||
170 | if(color.borderInfo.borderStyle) { | ||
171 | this.setProperty(el, "border-style", color.borderInfo.borderStyle); | ||
172 | } | ||
165 | } | 173 | } |
166 | } | 174 | } |
167 | } | 175 | } |
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index e9dde5fc..8d7b74f0 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js | |||
@@ -20,8 +20,10 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
20 | color; | 20 | color; |
21 | switch(p) { | 21 | switch(p) { |
22 | case "strokeSize": | 22 | case "strokeSize": |
23 | // TODO - For now, just handling px units. | ||
24 | this.setShapeProperty(el, "strokeSize", value); | 23 | this.setShapeProperty(el, "strokeSize", value); |
24 | var strokeInfo = njModule.NJUtils.getValueAndUnits(value); | ||
25 | val = this.GetValueInPixels(strokeInfo[0], strokeInfo[1]); | ||
26 | |||
25 | // TODO - For now, just handle Line, Rectangle and Oval. Eventually, move this into each class's | 27 | // TODO - For now, just handle Line, Rectangle and Oval. Eventually, move this into each class's |
26 | // setStrokeWidth code like SubPath and BrushStroke do. | 28 | // setStrokeWidth code like SubPath and BrushStroke do. |
27 | var geomType = el.elementModel.shapeModel.GLGeomObj.geomType(); | 29 | var geomType = el.elementModel.shapeModel.GLGeomObj.geomType(); |
@@ -527,16 +529,6 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
527 | } | 529 | } |
528 | else | 530 | else |
529 | { | 531 | { |
530 | // Support for ink-bottle tool | ||
531 | if(color.strokeInfo) | ||
532 | { | ||
533 | var strokeWidth = this.GetValueInPixels(color.strokeInfo.strokeSize, | ||
534 | color.strokeInfo.strokeUnits); | ||
535 | el.elementModel.shapeModel.GLGeomObj.setStrokeWidth(strokeWidth); | ||
536 | this.setShapeProperty(el, "strokeSize", color.strokeInfo.strokeSize + " " | ||
537 | + color.strokeInfo.strokeUnits); | ||
538 | } | ||
539 | |||
540 | if(mode) | 532 | if(mode) |
541 | { | 533 | { |
542 | switch (mode) { | 534 | switch (mode) { |
@@ -559,6 +551,12 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
559 | el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl); | 551 | el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl); |
560 | } | 552 | } |
561 | } | 553 | } |
554 | |||
555 | // Support for ink-bottle tool | ||
556 | if(color.strokeInfo) | ||
557 | { | ||
558 | this.setProperty(el, "strokeSize", color.strokeInfo.strokeSize + " " + color.strokeInfo.strokeUnits); | ||
559 | } | ||
562 | } | 560 | } |
563 | el.elementModel.shapeModel.GLWorld.render(); | 561 | el.elementModel.shapeModel.GLWorld.render(); |
564 | this.application.ninja.documentController.activeDocument.needsSave = true; | 562 | this.application.ninja.documentController.activeDocument.needsSave = true; |
diff --git a/js/controllers/elements/stage-controller.js b/js/controllers/elements/stage-controller.js index 3ef7dacc..e9779c81 100755 --- a/js/controllers/elements/stage-controller.js +++ b/js/controllers/elements/stage-controller.js | |||
@@ -182,5 +182,5 @@ exports.StageController = Montage.create(ElementController, { | |||
182 | return dist; | 182 | return dist; |
183 | } | 183 | } |
184 | } | 184 | } |
185 | }, | 185 | } |
186 | }); | 186 | }); |