From 486842239c71e7964f38a09aacda4970f2a82e1a Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 7 Feb 2012 10:58:14 -0800 Subject: 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 --- js/tools/RectTool.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'js/tools/RectTool.js') 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, { var strokeMaterial = null; var fillMaterial = null; - var strokeIndex = parseInt(this.options.strokeMaterial); - if(strokeIndex > 0) + var strokeM = this.options.strokeMaterial; + if(strokeM) { - strokeMaterial = Object.create(MaterialsLibrary.getMaterialAt(strokeIndex-1)); + strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM)); } - var fillIndex = parseInt(this.options.fillMaterial); - if(fillIndex > 0) + var fillM = this.options.fillMaterial; + if(fillM) { - fillMaterial = Object.create(MaterialsLibrary.getMaterialAt(fillIndex-1)); + fillMaterial = Object.create(MaterialsLibrary.getMaterial(fillM)); } var world = this.getGLWorld(canvas, this.options.use3D); @@ -110,8 +110,6 @@ exports.RectTool = Montage.create(ShapeTool, { canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; canvas.elementModel.shapeModel.fillMaterial = fillMaterial; - canvas.elementModel.shapeModel.strokeMaterialIndex = strokeIndex; - canvas.elementModel.shapeModel.fillMaterialIndex = fillIndex; canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; canvas.elementModel.shapeModel.strokeStyle = strokeStyle; -- cgit v1.2.3