From f04cc0146d8f7573628678613a99c270116768e4 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 29 Feb 2012 16:45:40 -0800 Subject: Last-used material (instead of FlatMaterial) is applied to shape when turning on use WebGL checkbox in the PI. Signed-off-by: Nivesh Rajbhandari --- js/tools/RectTool.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'js/tools/RectTool.js') diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js index 31ac7faa..5e148de3 100755 --- a/js/tools/RectTool.js +++ b/js/tools/RectTool.js @@ -62,16 +62,19 @@ exports.RectTool = Montage.create(ShapeTool, { var strokeMaterial = null; var fillMaterial = null; - var strokeM = this.options.strokeMaterial; - if(strokeM) + if(this.options.use3D) { - strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM)); - } + var strokeM = this.options.strokeMaterial; + if(strokeM) + { + strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM)); + } - var fillM = this.options.fillMaterial; - if(fillM) - { - fillMaterial = Object.create(MaterialsLibrary.getMaterial(fillM)); + var fillM = this.options.fillMaterial; + if(fillM) + { + fillMaterial = Object.create(MaterialsLibrary.getMaterial(fillM)); + } } var world = this.getGLWorld(canvas, this.options.use3D); -- cgit v1.2.3 From 84332ab81c1b445195f1d9be8bbeae0725c8e758 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 6 Mar 2012 10:58:25 -0800 Subject: Squashed commit of preload-fix into Master - Requiring all the previously pre-loaded files - RDGE, Codemirror and gl-matrix are not included via a script tag. Signed-off-by: Valerio Virgillito --- js/tools/RectTool.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'js/tools/RectTool.js') diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js index 5e148de3..957afea9 100755 --- a/js/tools/RectTool.js +++ b/js/tools/RectTool.js @@ -8,6 +8,9 @@ var Montage = require("montage/core/core").Montage, ShapeTool = require("js/tools/ShapeTool").ShapeTool, ShapesController = require("js/controllers/elements/shapes-controller").ShapesController; +var Rectangle = require("js/lib/geom/rectangle").Rectangle; +var MaterialsModel = require("js/models/materials-model").MaterialsModel; + exports.RectTool = Montage.create(ShapeTool, { _toolID: { value: "rectTool" }, @@ -67,13 +70,13 @@ exports.RectTool = Montage.create(ShapeTool, { var strokeM = this.options.strokeMaterial; if(strokeM) { - strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM)); + strokeMaterial = Object.create(MaterialsModel.getMaterial(strokeM)); } var fillM = this.options.fillMaterial; if(fillM) { - fillMaterial = Object.create(MaterialsLibrary.getMaterial(fillM)); + fillMaterial = Object.create(MaterialsModel.getMaterial(fillM)); } } @@ -82,7 +85,7 @@ exports.RectTool = Montage.create(ShapeTool, { var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2); var yOffset = (canvas.height/2 - (top - canvas.offsetTop + h/2)); - var rect = new GLRectangle(); + var rect = new Rectangle(); rect.init(world, xOffset, yOffset, w, h, strokeSize, strokeColor, fillColor, tlRadius, trRadius, blRadius, brRadius, strokeMaterial, fillMaterial, strokeStyle); -- cgit v1.2.3