diff options
Diffstat (limited to 'js')
-rwxr-xr-x | js/controllers/elements/shapes-controller.js | 46 | ||||
-rwxr-xr-x | js/lib/drawing/world.js | 2 | ||||
-rwxr-xr-x | js/lib/geom/geom-obj.js | 36 | ||||
-rwxr-xr-x | js/tools/LineTool.js | 2 | ||||
-rwxr-xr-x | js/tools/OvalTool.js | 4 | ||||
-rwxr-xr-x | js/tools/RectTool.js | 4 |
6 files changed, 19 insertions, 75 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 0d6defe2..da4e6d1b 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js | |||
@@ -142,7 +142,7 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
142 | if(m) | 142 | if(m) |
143 | { | 143 | { |
144 | el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(m); | 144 | el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(m); |
145 | color = this.getMaterialColor(m); | 145 | color = this.getMaterialColor(value); |
146 | if(color) | 146 | if(color) |
147 | { | 147 | { |
148 | el.elementModel.shapeModel.GLGeomObj.setStrokeColor(color); | 148 | el.elementModel.shapeModel.GLGeomObj.setStrokeColor(color); |
@@ -156,7 +156,7 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
156 | if(m) | 156 | if(m) |
157 | { | 157 | { |
158 | el.elementModel.shapeModel.GLGeomObj.setFillMaterial(m); | 158 | el.elementModel.shapeModel.GLGeomObj.setFillMaterial(m); |
159 | color = this.getMaterialColor(m); | 159 | color = this.getMaterialColor(value); |
160 | if(color) | 160 | if(color) |
161 | { | 161 | { |
162 | el.elementModel.shapeModel.GLGeomObj.setFillColor(color); | 162 | el.elementModel.shapeModel.GLGeomObj.setFillColor(color); |
@@ -750,34 +750,14 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
750 | value: function(m) | 750 | value: function(m) |
751 | { | 751 | { |
752 | var css, | 752 | var css, |
753 | colorObj, | 753 | colorObj; |
754 | c, | 754 | if(m === "LinearGradientMaterial") |
755 | mName = m.getName(); | ||
756 | if(mName === "LinearGradientMaterial") | ||
757 | { | 755 | { |
758 | css = "-webkit-gradient(linear, left top, right top, from("; | 756 | css = "-webkit-gradient(linear, left top, right top, from(rgb(255, 0, 0)), color-stop(0.3, rgb(0, 255, 0)), color-stop(0.6, rgb(0, 0, 255)), to(rgb(0, 255, 255)))"; |
759 | c = this.webGlColorToCss(m, 1); | ||
760 | css += c.rgb + ")"; | ||
761 | c = this.webGlColorToCss(m, 2); | ||
762 | css += ", color-stop(" + c.stop + ", " + c.rgb + ")"; | ||
763 | c = this.webGlColorToCss(m, 3); | ||
764 | css += ", color-stop(" + c.stop + ", " + c.rgb + ")"; | ||
765 | c = this.webGlColorToCss(m, 4); | ||
766 | css += ", to(" + c.rgb + "))"; | ||
767 | // console.log(css); | ||
768 | } | 757 | } |
769 | else if(mName === "RadialGradientMaterial") | 758 | else if(m === "RadialGradientMaterial") |
770 | { | 759 | { |
771 | css = "-webkit-radial-gradient(50% 50%, ellipse cover, "; | 760 | css = "-webkit-radial-gradient(50% 50%, ellipse cover, rgb(255, 0, 0) 0%, rgb(0, 255, 0) 30%, rgb(0, 0, 255) 60%, rgb(0, 255, 255) 100%)"; |
772 | c = this.webGlColorToCss(m, 1); | ||
773 | css += c.rgb + " " + c.stop*100 + "%"; | ||
774 | c = this.webGlColorToCss(m, 2); | ||
775 | css += c.rgb + " " + c.stop*100 + "%"; | ||
776 | c = this.webGlColorToCss(m, 3); | ||
777 | css += c.rgb + " " + c.stop*100 + "%"; | ||
778 | c = this.webGlColorToCss(m, 4); | ||
779 | css += c.rgb + " " + c.stop*100 + "%)"; | ||
780 | // console.log(css); | ||
781 | } | 761 | } |
782 | 762 | ||
783 | if(css) | 763 | if(css) |
@@ -791,18 +771,6 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
791 | 771 | ||
792 | return null; | 772 | return null; |
793 | } | 773 | } |
794 | }, | ||
795 | |||
796 | webGlColorToCss: { | ||
797 | value: function(m, index) | ||
798 | { | ||
799 | var color, rgba, cStop; | ||
800 | color = m["getColor" + index](); | ||
801 | rgba = 'rgba(' + color[0]*255 + ',' + color[1]*255 + ',' + color[2]*255 + ',' + color[3] + ')'; | ||
802 | cStop = m["getColorStop" + index](); | ||
803 | |||
804 | return {rgb:rgba, stop: cStop}; | ||
805 | } | ||
806 | } | 774 | } |
807 | 775 | ||
808 | }); | 776 | }); |
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js index b46a002b..14e63f4a 100755 --- a/js/lib/drawing/world.js +++ b/js/lib/drawing/world.js | |||
@@ -31,7 +31,6 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { | |||
31 | this._canvas = canvas; | 31 | this._canvas = canvas; |
32 | if (this._useWebGL) | 32 | if (this._useWebGL) |
33 | { | 33 | { |
34 | preserveDrawingBuffer = true; | ||
35 | if(preserveDrawingBuffer) | 34 | if(preserveDrawingBuffer) |
36 | { | 35 | { |
37 | this._glContext = canvas.getContext("experimental-webgl", {preserveDrawingBuffer: true}); | 36 | this._glContext = canvas.getContext("experimental-webgl", {preserveDrawingBuffer: true}); |
@@ -79,7 +78,6 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { | |||
79 | this._firstRender = true; | 78 | this._firstRender = true; |
80 | 79 | ||
81 | this._worldCount = worldCounter; | 80 | this._worldCount = worldCounter; |
82 | console.log( "creating world " + this._worldCount ); | ||
83 | worldCounter++; | 81 | worldCounter++; |
84 | 82 | ||
85 | // keep a counter for generating node names | 83 | // keep a counter for generating node names |
diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js index 803dbb53..6f37ad1c 100755 --- a/js/lib/geom/geom-obj.js +++ b/js/lib/geom/geom-obj.js | |||
@@ -11,7 +11,6 @@ var MaterialsModel = require("js/models/materials-model").MaterialsModel; | |||
11 | // Super class for all geometry classes | 11 | // Super class for all geometry classes |
12 | /////////////////////////////////////////////////////////////////////// | 12 | /////////////////////////////////////////////////////////////////////// |
13 | exports.GeomObj = Object.create(Object.prototype, { | 13 | exports.GeomObj = Object.create(Object.prototype, { |
14 | { | ||
15 | /////////////////////////////////////////////////////////////////////// | 14 | /////////////////////////////////////////////////////////////////////// |
16 | // Constants | 15 | // Constants |
17 | /////////////////////////////////////////////////////////////////////// | 16 | /////////////////////////////////////////////////////////////////////// |
@@ -181,14 +180,12 @@ exports.GeomObj = Object.create(Object.prototype, { | |||
181 | /////////////////////////////////////////////////////////////////////// | 180 | /////////////////////////////////////////////////////////////////////// |
182 | // Methods | 181 | // Methods |
183 | /////////////////////////////////////////////////////////////////////// | 182 | /////////////////////////////////////////////////////////////////////// |
184 | setMaterialColor: { | 183 | setMaterialColor: { |
185 | value: function(c, type) { | 184 | value: function(c, type) { |
186 | var i = 0, | 185 | var i = 0, |
187 | nMats = 0; | 186 | nMats = 0; |
188 | if (c) { | 187 | if (c) { |
189 | if (c.gradientMode) { | 188 | if (c.gradientMode) { |
190 | if (c.gradientMode) | ||
191 | { | ||
192 | // Gradient support | 189 | // Gradient support |
193 | if (this._materialArray && this._materialTypeArray) { | 190 | if (this._materialArray && this._materialTypeArray) { |
194 | nMats = this._materialArray.length; | 191 | nMats = this._materialArray.length; |
@@ -204,7 +201,6 @@ exports.GeomObj = Object.create(Object.prototype, { | |||
204 | } | 201 | } |
205 | 202 | ||
206 | for (var n = 0; n < len; n++) { | 203 | for (var n = 0; n < len; n++) { |
207 | { | ||
208 | var position = colors[n].position / 100; | 204 | var position = colors[n].position / 100; |
209 | var cs = colors[n].value; | 205 | var cs = colors[n].value; |
210 | var stop = [cs.r / 255, cs.g / 255, cs.b / 255, cs.a]; | 206 | var stop = [cs.r / 255, cs.g / 255, cs.b / 255, cs.a]; |
@@ -213,9 +209,6 @@ exports.GeomObj = Object.create(Object.prototype, { | |||
213 | if (nMats === this._materialTypeArray.length) { | 209 | if (nMats === this._materialTypeArray.length) { |
214 | for (i = 0; i < nMats; i++) { | 210 | for (i = 0; i < nMats; i++) { |
215 | if (this._materialTypeArray[i] == type) { | 211 | if (this._materialTypeArray[i] == type) { |
216 | { | ||
217 | if (this._materialTypeArray[i] == type) | ||
218 | { | ||
219 | this._materialArray[i].setProperty("color" + (n + 1), stop.slice(0)); | 212 | this._materialArray[i].setProperty("color" + (n + 1), stop.slice(0)); |
220 | this._materialArray[i].setProperty("colorStop" + (n + 1), position); | 213 | this._materialArray[i].setProperty("colorStop" + (n + 1), position); |
221 | } | 214 | } |
@@ -225,15 +218,12 @@ exports.GeomObj = Object.create(Object.prototype, { | |||
225 | if (type === "fill") { | 218 | if (type === "fill") { |
226 | this._fillColor = c; | 219 | this._fillColor = c; |
227 | } else { | 220 | } else { |
228 | else { | ||
229 | this._strokeColor = c; | 221 | this._strokeColor = c; |
230 | } | 222 | } |
231 | } else { | 223 | } else { |
232 | else { | ||
233 | if (type === "fill") { | 224 | if (type === "fill") { |
234 | this._fillColor = c.slice(0); | 225 | this._fillColor = c.slice(0); |
235 | } else { | 226 | } else { |
236 | else { | ||
237 | this._strokeColor = c.slice(0); | 227 | this._strokeColor = c.slice(0); |
238 | } | 228 | } |
239 | 229 | ||
@@ -241,7 +231,6 @@ exports.GeomObj = Object.create(Object.prototype, { | |||
241 | nMats = this._materialArray.length; | 231 | nMats = this._materialArray.length; |
242 | if (nMats === this._materialTypeArray.length) { | 232 | if (nMats === this._materialTypeArray.length) { |
243 | for (i = 0; i < nMats; i++) { | 233 | for (i = 0; i < nMats; i++) { |
244 | { | ||
245 | if (this._materialTypeArray[i] == type) { | 234 | if (this._materialTypeArray[i] == type) { |
246 | this._materialArray[i].setProperty("color", c.slice(0)); | 235 | this._materialArray[i].setProperty("color", c.slice(0)); |
247 | } | 236 | } |
@@ -250,24 +239,17 @@ exports.GeomObj = Object.create(Object.prototype, { | |||
250 | } | 239 | } |
251 | } | 240 | } |
252 | } else { | 241 | } else { |
253 | else | ||
254 | { | ||
255 | if (type === "fill") { | 242 | if (type === "fill") { |
256 | this._fillColor = null; | 243 | this._fillColor = null; |
257 | } else { | 244 | } else { |
258 | else { | ||
259 | this._strokeColor = null; | 245 | this._strokeColor = null; |
260 | } | 246 | } |
261 | 247 | ||
262 | if (this._materialArray && this._materialTypeArray) { | 248 | if (this._materialArray && this._materialTypeArray) { |
263 | { | ||
264 | nMats = this._materialArray.length; | 249 | nMats = this._materialArray.length; |
265 | if (nMats === this._materialTypeArray.length) { |