aboutsummaryrefslogtreecommitdiff
path: root/js/tools/OvalTool.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tools/OvalTool.js')
-rwxr-xr-xjs/tools/OvalTool.js30
1 files changed, 19 insertions, 11 deletions
diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js
index 94e4745e..970dc453 100755
--- a/js/tools/OvalTool.js
+++ b/js/tools/OvalTool.js
@@ -28,31 +28,31 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28POSSIBILITY OF SUCH DAMAGE. 28POSSIBILITY OF SUCH DAMAGE.
29</copyright> */ 29</copyright> */
30 30
31var Montage = require("montage/core/core").Montage, 31var Montage = require("montage/core/core").Montage,
32 ShapeTool = require("js/tools/ShapeTool").ShapeTool, 32 ShapeTool = require("js/tools/ShapeTool").ShapeTool,
33 ShapesController = require("js/controllers/elements/shapes-controller").ShapesController; 33 ShapesController = require("js/controllers/elements/shapes-controller").ShapesController;
34 34
35var Circle = require("js/lib/geom/circle").Circle; 35var Circle = require("js/lib/geom/circle").Circle;
36var MaterialsModel = require("js/models/materials-model").MaterialsModel; 36var MaterialsModel = require("js/models/materials-model").MaterialsModel;
37 37
38exports.OvalTool = Montage.create(ShapeTool, { 38exports.OvalTool = Montage.create(ShapeTool, {
39 39
40 _toolID: { value: "ovalTool" }, 40 _toolID: { value: "ovalTool" },
41 _imageID: { value: "ovalToolImg" }, 41 _imageID: { value: "ovalToolImg" },
42 _toolImageClass: { value: "ovalToolUp" }, 42 _toolImageClass: { value: "ovalToolUp" },
43 _selectedToolImageClass: { value: "ovalToolDown" }, 43 _selectedToolImageClass: { value: "ovalToolDown" },
44 _toolTipText: { value: "Oval Tool (O)" }, 44 _toolTipText: { value: "Oval Tool (O)" },
45 _selectedToolClass:{value:"ovalToolSpecificProperties"}, 45 _selectedToolClass:{value:"ovalToolSpecificProperties"},
46 _ovalView : { value: null, writable: true}, 46 _ovalView : { value: null, writable: true},
47 47
48 RenderShape: { 48 RenderShape: {
49 value: function (w, h, planeMat, midPt, canvas) 49 value: function (w, h, planeMat, midPt, canvas)
50 { 50 {
51 if( (Math.floor(w) === 0) || (Math.floor(h) === 0) ) 51 if( (Math.floor(w) === 0) || (Math.floor(h) === 0) )
52 { 52 {
53 return; 53 return;
54 } 54 }
55 55
56 var left = Math.round(midPt[0] - 0.5*w); 56 var left = Math.round(midPt[0] - 0.5*w);
57 var top = Math.round(midPt[1] - 0.5*h); 57 var top = Math.round(midPt[1] - 0.5*h);
58 58
@@ -78,14 +78,22 @@ exports.OvalTool = Montage.create(ShapeTool, {
78 { 78 {
79 strokeMaterial = Object.create(MaterialsModel.getMaterial(strokeM)); 79 strokeMaterial = Object.create(MaterialsModel.getMaterial(strokeM));
80 } 80 }
81 strokeColor = ShapesController.getMaterialColor(strokeM) || strokeColor; 81 if (strokeMaterial && this.options.stroke.color && (strokeMaterial.gradientType === this.options.stroke.color.gradientMode)) {
82 strokeColor = {gradientMode:strokeMaterial.gradientType, color:this.options.stroke.color.stops};
83 } else {
84 strokeColor = ShapesController.getMaterialColor(strokeM) || strokeColor;
85 }
82 86
83 fillM = this.options.fillMaterial; 87 fillM = this.options.fillMaterial;
84 if(fillM) 88 if(fillM)
85 { 89 {
86 fillMaterial = Object.create(MaterialsModel.getMaterial(fillM)); 90 fillMaterial = Object.create(MaterialsModel.getMaterial(fillM));
87 } 91 }
88 fillColor = ShapesController.getMaterialColor(fillM) || fillColor; 92 if (fillMaterial && this.options.fill.color && (fillMaterial.gradientType === this.options.fill.color.gradientMode)) {
93 fillColor = {gradientMode:fillMaterial.gradientType, color:this.options.fill.color.stops};
94 } else {
95 fillColor = ShapesController.getMaterialColor(fillM) || fillColor;
96 }
89 } 97 }
90 98
91 var world = this.getGLWorld(canvas, this.options.use3D); 99 var world = this.getGLWorld(canvas, this.options.use3D);