aboutsummaryrefslogtreecommitdiff
path: root/js/models
diff options
context:
space:
mode:
authorArmen Kesablyan2012-02-07 16:51:14 -0800
committerArmen Kesablyan2012-02-07 16:51:14 -0800
commit8110e01dc5093ac6baf621103dcaa5f769e5be92 (patch)
treeecf339e3097b6ba25d81cbe44d913ee67591bf4b /js/models
parent5f506542d28e12b707c3bfa41b53383519838477 (diff)
parent668510892537eaaeb2e11520831d87b44b2489b7 (diff)
downloadninja-8110e01dc5093ac6baf621103dcaa5f769e5be92.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal
Diffstat (limited to 'js/models')
-rw-r--r--js/models/color-model.js43
-rw-r--r--js/models/element-model.js8
-rw-r--r--js/models/properties-3d.js6
-rw-r--r--js/models/shape-model.js2
4 files changed, 54 insertions, 5 deletions
diff --git a/js/models/color-model.js b/js/models/color-model.js
index 7e5fee1f..2c86422f 100644
--- a/js/models/color-model.js
+++ b/js/models/color-model.js
@@ -415,8 +415,10 @@ exports.ColorModel = Montage.create(Component, {
415 colorEvent.alpha = this.alpha.value; 415 colorEvent.alpha = this.alpha.value;
416 if (this.hsl) 416 if (this.hsl)
417 colorEvent.hsla = {h: this.hsl.h, s: this.hsl.s, l: this.hsl.l, a: this.alpha.value, css: 'hsla('+this.hsl.h+', '+this.hsl.s+'%, '+this.hsl.l+'%, '+this.alpha.value+')'}; 417 colorEvent.hsla = {h: this.hsl.h, s: this.hsl.s, l: this.hsl.l, a: this.alpha.value, css: 'hsla('+this.hsl.h+', '+this.hsl.s+'%, '+this.hsl.l+'%, '+this.alpha.value+')'};
418 if (this.rgb) 418 if (this.rgb) {
419 colorEvent.rgba = {r: this.rgb.r, g: this.rgb.g, b: this.rgb.b, a: this.alpha.value, css: 'rgba('+ this.rgb.r +', '+this.rgb.g+', '+this.rgb.b+', '+this.alpha.value+')'}; 419 colorEvent.rgba = {r: this.rgb.r, g: this.rgb.g, b: this.rgb.b, a: this.alpha.value, css: 'rgba('+ this.rgb.r +', '+this.rgb.g+', '+this.rgb.b+', '+this.alpha.value+')'};
420 colorEvent.webGlColor = [this.rgb.r/255, this.rgb.g/255, this.rgb.b/255, this.alpha.value];
421 }
420 if (this.hex) 422 if (this.hex)
421 colorEvent.hex = this.hex; 423 colorEvent.hex = this.hex;
422 //Standard values that apply to any event 424 //Standard values that apply to any event
@@ -560,7 +562,44 @@ exports.ColorModel = Montage.create(Component, {
560 //Returning RGB object 562 //Returning RGB object
561 return {r: Math.round(r * 255), g: Math.round(g * 255), b: Math.round(b * 255)}; 563 return {r: Math.round(r * 255), g: Math.round(g * 255), b: Math.round(b * 255)};
562 } 564 }
563 } 565 },
566 ////////////////////////////////////////////////////////////////////
567 //Returns WebGL color array in [r, g, b, a] format where the values are [0,1] given a color object
568 colorToWebGl: {
569 enumerable: true,
570 value: function (color) {
571 var temp;
572 if (color) {
573 if(color.l !== undefined) {
574 temp = this.hslToRgb(color.h/360, color.s/100, color.l/100);
575 } else if (color.r !== undefined) {
576 temp = color;
577 }
578 temp.a = color.a;
579 }
580 //WebGL uses array
581 if (temp) {
582 return [temp.r/255, temp.g/255, temp.b/255, temp.a];
583 } else {
584 return null;
585 }
586 }
587 },
588 ////////////////////////////////////////////////////////////////////
589 //Returns CSS string given a WebGL color array in [r, g, b, a] format where the values are [0,1]
590 webGlToCss: {
591 enumerable: true,
592 value: function (color) {
593 if(color && (color.length === 4))
594 {
595 return 'rgba(' + color[0]*255 + ', ' + color[1]*255 + ', ' + color[2]*255 + ', ' + color[3] +')';
596 }
597 else
598 {
599 return null;
600 }
601 }
602 }
564 //////////////////////////////////////////////////////////////////// 603 ////////////////////////////////////////////////////////////////////
565 //////////////////////////////////////////////////////////////////// 604 ////////////////////////////////////////////////////////////////////
566 //////////////////////////////////////////////////////////////////// 605 ////////////////////////////////////////////////////////////////////
diff --git a/js/models/element-model.js b/js/models/element-model.js
index 6e1ac07a..831e8b1e 100644
--- a/js/models/element-model.js
+++ b/js/models/element-model.js
@@ -37,6 +37,12 @@ exports.ElementModel = Montage.create(Montage, {
37 /** 37 /**
38 * SnapManager 2d Snap Cache Info 38 * SnapManager 2d Snap Cache Info
39 */ 39 */
40 isIn2DSnapCache : { value: false } 40 isIn2DSnapCache : { value: false },
41
42 /**
43 * Color info
44 */
45 fill: { value: null },
46 stroke: { value: null }
41 47
42}); \ No newline at end of file 48}); \ No newline at end of file
diff --git a/js/models/properties-3d.js b/js/models/properties-3d.js
index 6d65bc91..cf4a045f 100644
--- a/js/models/properties-3d.js
+++ b/js/models/properties-3d.js
@@ -22,7 +22,7 @@ exports.Properties3D = Montage.create(Component, {
22 _world : {value : null, enumerable:true}, // keep a referenceto the GLWorld (if any) 22 _world : {value : null, enumerable:true}, // keep a referenceto the GLWorld (if any)
23 23
24 // Keep track of 3d properties 24 // Keep track of 3d properties
25 matrix3d : {value : [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1], enumerable: true}, 25 matrix3d : {value : null, enumerable: true},
26 26
27 xAngle : {value : 0, enumerable: true}, 27 xAngle : {value : 0, enumerable: true},
28 yAngle : {value : 0, enumerable: true}, 28 yAngle : {value : 0, enumerable: true},
@@ -33,9 +33,11 @@ exports.Properties3D = Montage.create(Component, {
33 z3D : {value : 0, enumerable: true}, 33 z3D : {value : 0, enumerable: true},
34 34
35 //TODO - not sure if this should be part of the tool or stage or a utility 35 //TODO - not sure if this should be part of the tool or stage or a utility
36 perspectiveDist : { value : 1400, enumerable: true}, 36 perspectiveDist : { value : null, enumerable: true},
37 perspectiveMode : { value : null, enumerable: true}, 37 perspectiveMode : { value : null, enumerable: true},
38 38
39 elementPlane : { value : null, enumerable: true},
40
39 init : { 41 init : {
40 value : function(elt) { 42 value : function(elt) {
41 43
diff --git a/js/models/shape-model.js b/js/models/shape-model.js
index 9d4fff6f..b643a7b5 100644
--- a/js/models/shape-model.js
+++ b/js/models/shape-model.js
@@ -20,10 +20,12 @@ exports.ShapeModel = Montage.create(Component, {
20 strokeMaterialIndex: { value: null }, 20 strokeMaterialIndex: { value: null },
21 strokeStyle: { value: null }, 21 strokeStyle: { value: null },
22 strokeStyleIndex: { value: null }, 22 strokeStyleIndex: { value: null },
23 border: { value: null }, // Store css value for ColorController
23 24
24 fill: { value: null }, 25 fill: { value: null },
25 fillMaterial: { value: null }, 26 fillMaterial: { value: null },
26 fillMaterialIndex: { value: null }, 27 fillMaterialIndex: { value: null },
28 background: { value: null }, // Store css value for ColorController
27 29
28 // Line-specific 30 // Line-specific
29 slope: { value: null }, 31 slope: { value: null },