aboutsummaryrefslogtreecommitdiff
path: root/js/tools/RectTool.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-08 10:18:36 -0800
committerValerio Virgillito2012-02-08 10:18:36 -0800
commit763910b9d074137eb7dee80447b89407ce5750c9 (patch)
tree3c8820a06afd442fa5ba8e68665a4d2836230628 /js/tools/RectTool.js
parente5579374ff39b80b8c0c69faba37f6f581758fe0 (diff)
parent329a859e2666716c3a1d99c6bd2679e10c81fc8d (diff)
downloadninja-763910b9d074137eb7dee80447b89407ce5750c9.tar.gz
Merge pull request #20 from mqg734/ToolFixes
Hooked up materials code to go through the ShapesController and updated the PI to reflect the currently selected shape's materials. Also fixed the following bugs:
Diffstat (limited to 'js/tools/RectTool.js')
-rw-r--r--js/tools/RectTool.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js
index 94d80b53..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,13 +110,12 @@ 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;
118 116
119 canvas.elementModel.shapeModel.GLGeomObj = rect; 117 canvas.elementModel.shapeModel.GLGeomObj = rect;
118 canvas.elementModel.shapeModel.useWebGl = this.options.use3D;
120 } 119 }
121 else 120 else
122 { 121 {