diff options
author | Nivesh Rajbhandari | 2012-02-07 10:58:14 -0800 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-02-07 10:58:14 -0800 |
commit | 486842239c71e7964f38a09aacda4970f2a82e1a (patch) | |
tree | 20a6688d296b1ef09bf32add9dfdef586bfe4207 /js/tools | |
parent | 789eaf5a92c903f27462c69a8890fbec695ab14e (diff) | |
download | ninja-486842239c71e7964f38a09aacda4970f2a82e1a.tar.gz |
Updated tools and PI to get/set materials by binding to appModel's materials property. This requires us to add FlatMaterial to the list of materials in the MaterialsLibrary.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/tools')
-rw-r--r-- | js/tools/LineTool.js | 7 | ||||
-rw-r--r-- | js/tools/OvalTool.js | 14 | ||||
-rw-r--r-- | js/tools/RectTool.js | 14 |
3 files changed, 15 insertions, 20 deletions
diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js index 6a948fd8..99c374a7 100644 --- a/js/tools/LineTool.js +++ b/js/tools/LineTool.js | |||
@@ -203,10 +203,10 @@ exports.LineTool = Montage.create(ShapeTool, { | |||
203 | // for default stroke and fill/no materials | 203 | // for default stroke and fill/no materials |
204 | var strokeMaterial = null; | 204 | var strokeMaterial = null; |
205 | 205 | ||
206 | var strokeIndex = parseInt(this.options.strokeMaterial); | 206 | var strokeM = this.options.strokeMaterial; |
207 | if(strokeIndex > 0) | 207 | if(strokeM) |
208 | { | 208 | { |
209 | strokeMaterial = Object.create(MaterialsLibrary.getMaterialAt(strokeIndex-1)); | 209 | strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM)); |
210 | } | 210 | } |
211 | 211 | ||
212 | var world = this.getGLWorld(canvas, this.options.use3D); | 212 | var world = this.getGLWorld(canvas, this.options.use3D); |
@@ -232,7 +232,6 @@ exports.LineTool = Montage.create(ShapeTool, { | |||
232 | } | 232 | } |
233 | 233 | ||
234 | canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; | 234 | canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; |
235 | canvas.elementModel.shapeModel.strokeMaterialIndex = strokeIndex; | ||
236 | 235 | ||
237 | canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; | 236 | canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; |
238 | canvas.elementModel.shapeModel.strokeStyle = strokeStyle; | 237 | canvas.elementModel.shapeModel.strokeStyle = strokeStyle; |
diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js index 446c6754..14655312 100644 --- a/js/tools/OvalTool.js +++ b/js/tools/OvalTool.js | |||
@@ -43,16 +43,16 @@ exports.OvalTool = Montage.create(ShapeTool, { | |||
43 | var strokeMaterial = null; | 43 | var strokeMaterial = null; |
44 | var fillMaterial = null; | 44 | var fillMaterial = null; |
45 | 45 | ||
46 | var strokeIndex = parseInt(this.options.strokeMaterial); | 46 | var strokeM = this.options.strokeMaterial; |
47 | if(strokeIndex > 0) | 47 | if(strokeM) |
48 | { | 48 | { |
49 | strokeMaterial = Object.create(MaterialsLibrary.getMaterialAt(strokeIndex-1)); | 49 | strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM)); |
50 | } | 50 | } |
51 | 51 | ||
52 | var fillIndex = parseInt(this.options.fillMaterial); | 52 | var fillM = this.options.fillMaterial; |
53 | if(fillIndex > 0) | 53 | if(fillM) |
54 | { | 54 | { |
55 | fillMaterial = Object.create(MaterialsLibrary.getMaterialAt(fillIndex-1)); | 55 | fillMaterial = Object.create(MaterialsLibrary.getMaterial(fillM)); |
56 | } | 56 | } |
57 | 57 | ||
58 | 58 | ||
@@ -88,8 +88,6 @@ exports.OvalTool = Montage.create(ShapeTool, { | |||
88 | 88 | ||
89 | canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; | 89 | canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; |
90 | canvas.elementModel.shapeModel.fillMaterial = fillMaterial; | 90 | canvas.elementModel.shapeModel.fillMaterial = fillMaterial; |
91 | canvas.elementModel.shapeModel.strokeMaterialIndex = strokeIndex; | ||
92 | canvas.elementModel.shapeModel.fillMaterialIndex = fillIndex; | ||
93 | 91 | ||
94 | canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; | 92 | canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; |
95 | canvas.elementModel.shapeModel.strokeStyle = strokeStyle; | 93 | canvas.elementModel.shapeModel.strokeStyle = strokeStyle; |
diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js index 6109ee4d..31ac7faa 100644 --- a/js/tools/RectTool.js +++ b/js/tools/RectTool.js | |||
@@ -62,16 +62,16 @@ exports.RectTool = Montage.create(ShapeTool, { | |||
62 | var strokeMaterial = null; | 62 | var strokeMaterial = null; |
63 | var fillMaterial = null; | 63 | var fillMaterial = null; |
64 | 64 | ||
65 | var strokeIndex = parseInt(this.options.strokeMaterial); | 65 | var strokeM = this.options.strokeMaterial; |
66 | if(strokeIndex > 0) | 66 | if(strokeM) |
67 | { | 67 | { |
68 | strokeMaterial = Object.create(MaterialsLibrary.getMaterialAt(strokeIndex-1)); | 68 | strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM)); |
69 | } | 69 | } |
70 | 70 | ||
71 | var fillIndex = parseInt(this.options.fillMaterial); | 71 | var fillM = this.options.fillMaterial; |
72 | if(fillIndex > 0) | 72 | if(fillM) |
73 | { | 73 | { |
74 | fillMaterial = Object.create(MaterialsLibrary.getMaterialAt(fillIndex-1)); | 74 | fillMaterial = Object.create(MaterialsLibrary.getMaterial(fillM)); |
75 | } | 75 | } |
76 | 76 | ||
77 | var world = this.getGLWorld(canvas, this.options.use3D); | 77 | var world = this.getGLWorld(canvas, this.options.use3D); |
@@ -110,8 +110,6 @@ exports.RectTool = Montage.create(ShapeTool, { | |||
110 | 110 | ||
111 | canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; | 111 | canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; |
112 | canvas.elementModel.shapeModel.fillMaterial = fillMaterial; | 112 | canvas.elementModel.shapeModel.fillMaterial = fillMaterial; |
113 | canvas.elementModel.shapeModel.strokeMaterialIndex = strokeIndex; | ||
114 | canvas.elementModel.shapeModel.fillMaterialIndex = fillIndex; | ||
115 | 113 | ||
116 | canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; | 114 | canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; |
117 | canvas.elementModel.shapeModel.strokeStyle = strokeStyle; | 115 | canvas.elementModel.shapeModel.strokeStyle = strokeStyle; |