aboutsummaryrefslogtreecommitdiff
path: root/js/tools/RectTool.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tools/RectTool.js')
-rwxr-xr-xjs/tools/RectTool.js24
1 files changed, 15 insertions, 9 deletions
diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js
index 31ac7faa..957afea9 100755
--- a/js/tools/RectTool.js
+++ b/js/tools/RectTool.js
@@ -8,6 +8,9 @@ var Montage = require("montage/core/core").Montage,
8 ShapeTool = require("js/tools/ShapeTool").ShapeTool, 8 ShapeTool = require("js/tools/ShapeTool").ShapeTool,
9 ShapesController = require("js/controllers/elements/shapes-controller").ShapesController; 9 ShapesController = require("js/controllers/elements/shapes-controller").ShapesController;
10 10
11var Rectangle = require("js/lib/geom/rectangle").Rectangle;
12var MaterialsModel = require("js/models/materials-model").MaterialsModel;
13
11exports.RectTool = Montage.create(ShapeTool, { 14exports.RectTool = Montage.create(ShapeTool, {
12 15
13 _toolID: { value: "rectTool" }, 16 _toolID: { value: "rectTool" },
@@ -62,16 +65,19 @@ exports.RectTool = Montage.create(ShapeTool, {
62 var strokeMaterial = null; 65 var strokeMaterial = null;
63 var fillMaterial = null; 66 var fillMaterial = null;
64 67
65 var strokeM = this.options.strokeMaterial; 68 if(this.options.use3D)
66 if(strokeM)
67 { 69 {
68 strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM)); 70 var strokeM = this.options.strokeMaterial;
69 } 71 if(strokeM)
72 {
73 strokeMaterial = Object.create(MaterialsModel.getMaterial(strokeM));
74 }
70 75
71 var fillM = this.options.fillMaterial; 76 var fillM = this.options.fillMaterial;
72 if(fillM) 77 if(fillM)
73 { 78 {
74 fillMaterial = Object.create(MaterialsLibrary.getMaterial(fillM)); 79 fillMaterial = Object.create(MaterialsModel.getMaterial(fillM));
80 }
75 } 81 }
76 82
77 var world = this.getGLWorld(canvas, this.options.use3D); 83 var world = this.getGLWorld(canvas, this.options.use3D);
@@ -79,7 +85,7 @@ exports.RectTool = Montage.create(ShapeTool, {
79 var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2); 85 var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2);
80 var yOffset = (canvas.height/2 - (top - canvas.offsetTop + h/2)); 86 var yOffset = (canvas.height/2 - (top - canvas.offsetTop + h/2));
81 87
82 var rect = new GLRectangle(); 88 var rect = new Rectangle();
83 rect.init(world, xOffset, yOffset, w, h, strokeSize, strokeColor, fillColor, 89 rect.init(world, xOffset, yOffset, w, h, strokeSize, strokeColor, fillColor,
84 tlRadius, trRadius, blRadius, brRadius, strokeMaterial, fillMaterial, strokeStyle); 90 tlRadius, trRadius, blRadius, brRadius, strokeMaterial, fillMaterial, strokeStyle);
85 91