aboutsummaryrefslogtreecommitdiff
path: root/js/tools/OvalTool.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tools/OvalTool.js')
-rwxr-xr-xjs/tools/OvalTool.js25
1 files changed, 15 insertions, 10 deletions
diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js
index 14655312..a10e0bb5 100755
--- a/js/tools/OvalTool.js
+++ b/js/tools/OvalTool.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 Circle = require("js/lib/geom/circle").Circle;
12var MaterialsModel = require("js/models/materials-model").MaterialsModel;
13
11exports.OvalTool = Montage.create(ShapeTool, { 14exports.OvalTool = Montage.create(ShapeTool, {
12 15
13 _toolID: { value: "ovalTool" }, 16 _toolID: { value: "ovalTool" },
@@ -43,25 +46,27 @@ exports.OvalTool = Montage.create(ShapeTool, {
43 var strokeMaterial = null; 46 var strokeMaterial = null;
44 var fillMaterial = null; 47 var fillMaterial = null;
45 48
46 var strokeM = this.options.strokeMaterial; 49 if(this.options.use3D)
47 if(strokeM)
48 { 50 {
49 strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM)); 51 var strokeM = this.options.strokeMaterial;
50 } 52 if(strokeM)
53 {
54 strokeMaterial = Object.create(MaterialsModel.getMaterial(strokeM));
55 }
51 56
52 var fillM = this.options.fillMaterial; 57 var fillM = this.options.fillMaterial;
53 if(fillM) 58 if(fillM)
54 { 59 {
55 fillMaterial = Object.create(MaterialsLibrary.getMaterial(fillM)); 60 fillMaterial = Object.create(MaterialsModel.getMaterial(fillM));
61 }
56 } 62 }
57 63
58
59 var world = this.getGLWorld(canvas, this.options.use3D); 64 var world = this.getGLWorld(canvas, this.options.use3D);
60 65
61 var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2); 66 var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2);
62 var yOffset = (canvas.height/2 - (top - canvas.offsetTop + h/2)); 67 var yOffset = (canvas.height/2 - (top - canvas.offsetTop + h/2));
63 68
64 var oval = new GLCircle(); 69 var oval = new Circle(); //GLCircle();
65 oval.init(world, xOffset, yOffset, w, h, strokeSize, strokeColor, fillColor, innerRadius, strokeMaterial, fillMaterial, strokeStyle); 70 oval.init(world, xOffset, yOffset, w, h, strokeSize, strokeColor, fillColor, innerRadius, strokeMaterial, fillMaterial, strokeStyle);
66 71
67 world.addObject(oval); 72 world.addObject(oval);