aboutsummaryrefslogtreecommitdiff
path: root/js/tools/RectTool.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tools/RectTool.js')
-rwxr-xr-xjs/tools/RectTool.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js
index babd623a..a5cc49e2 100755
--- a/js/tools/RectTool.js
+++ b/js/tools/RectTool.js
@@ -28,9 +28,9 @@ 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 Rectangle = require("js/lib/geom/rectangle").Rectangle; 35var Rectangle = require("js/lib/geom/rectangle").Rectangle;
36var MaterialsModel = require("js/models/materials-model").MaterialsModel; 36var MaterialsModel = require("js/models/materials-model").MaterialsModel;
@@ -63,7 +63,7 @@ exports.RectTool = Montage.create(ShapeTool, {
63 _buttons: {enumerable: false,value: { hexinput: [] , lockbutton: []}}, 63 _buttons: {enumerable: false,value: { hexinput: [] , lockbutton: []}},
64 64
65 RenderShape: { 65 RenderShape: {
66 value: function (w, h, planeMat, midPt, canvas) 66 value: function (w, h, planeMat, midPt, canvas)
67 { 67 {
68 if( (Math.floor(w) === 0) || (Math.floor(h) === 0) ) 68 if( (Math.floor(w) === 0) || (Math.floor(h) === 0) )
69 { 69 {
@@ -98,14 +98,22 @@ exports.RectTool = Montage.create(ShapeTool, {
98 { 98 {
99 strokeMaterial = Object.create(MaterialsModel.getMaterial(strokeM)); 99 strokeMaterial = Object.create(MaterialsModel.getMaterial(strokeM));
100 } 100 }
101 strokeColor = ShapesController.getMaterialColor(strokeM) || strokeColor; 101 if (strokeMaterial && this.options.stroke.color && (strokeMaterial.gradientType === this.options.stroke.color.gradientMode)) {
102 strokeColor = {gradientMode:strokeMaterial.gradientType, color:this.options.stroke.color.stops};
103 } else {
104 strokeColor = ShapesController.getMaterialColor(strokeM) || strokeColor;
105 }
102 106
103 fillM = this.options.fillMaterial; 107 fillM = this.options.fillMaterial;
104 if(fillM) 108 if(fillM)
105 { 109 {
106 fillMaterial = Object.create(MaterialsModel.getMaterial(fillM)); 110 fillMaterial = Object.create(MaterialsModel.getMaterial(fillM));
107 } 111 }
108 fillColor = ShapesController.getMaterialColor(fillM) || fillColor; 112 if (fillMaterial && this.options.fill.color && (fillMaterial.gradientType === this.options.fill.color.gradientMode)) {
113 fillColor = {gradientMode:fillMaterial.gradientType, color:this.options.fill.color.stops};
114 } else {
115 fillColor = ShapesController.getMaterialColor(fillM) || fillColor;
116 }
109 } 117 }
110 118
111 var world = this.getGLWorld(canvas, this.options.use3D); 119 var world = this.getGLWorld(canvas, this.options.use3D);