diff options
author | Kruti Shah | 2012-07-17 12:40:00 -0700 |
---|---|---|
committer | Kruti Shah | 2012-07-17 12:40:00 -0700 |
commit | bf2d7bdb22c28089dc1067bc9094ebc590daac87 (patch) | |
tree | 2156d9920ea1b7db49ed6460545fea7cda121bae /js/models/color-model.js | |
parent | 7e2c2dbd040ed79a3f0678f91bd4b6db9cf69231 (diff) | |
parent | b4b3e45d6684e77d361b4f8ca5be4889428320c5 (diff) | |
download | ninja-bf2d7bdb22c28089dc1067bc9094ebc590daac87.tar.gz |
Merge branch 'refs/heads/TimelineUberJD' into Timeline-local-kruti
Diffstat (limited to 'js/models/color-model.js')
-rwxr-xr-x | js/models/color-model.js | 765 |
1 files changed, 383 insertions, 382 deletions
diff --git a/js/models/color-model.js b/js/models/color-model.js index cc41b59e..2c22081c 100755 --- a/js/models/color-model.js +++ b/js/models/color-model.js | |||
@@ -1,24 +1,25 @@ | |||
1 | /* <copyright> | 1 | /* <copyright> |
2 | Copyright (c) 2012, Motorola Mobility, Inc | 2 | Copyright (c) 2012, Motorola Mobility LLC. |
3 | All Rights Reserved. | 3 | All Rights Reserved. |
4 | BSD License. | ||
5 | 4 | ||
6 | Redistribution and use in source and binary forms, with or without | 5 | Redistribution and use in source and binary forms, with or without |
7 | modification, are permitted provided that the following conditions are met: | 6 | modification, are permitted provided that the following conditions are met: |
8 | 7 | ||
9 | - Redistributions of source code must retain the above copyright notice, | 8 | * Redistributions of source code must retain the above copyright notice, |
10 | this list of conditions and the following disclaimer. | 9 | this list of conditions and the following disclaimer. |
11 | - Redistributions in binary form must reproduce the above copyright | 10 | |
12 | notice, this list of conditions and the following disclaimer in the | 11 | * Redistributions in binary form must reproduce the above copyright notice, |
13 | documentation and/or other materials provided with the distribution. | 12 | this list of conditions and the following disclaimer in the documentation |
14 | - Neither the name of Motorola Mobility nor the names of its contributors | 13 | and/or other materials provided with the distribution. |
15 | may be used to endorse or promote products derived from this software | 14 | |
16 | without specific prior written permission. | 15 | * Neither the name of Motorola Mobility LLC nor the names of its |
16 | contributors may be used to endorse or promote products derived from this | ||
17 | software without specific prior written permission. | ||
17 | 18 | ||
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
@@ -30,426 +31,426 @@ POSSIBILITY OF SUCH DAMAGE. | |||
30 | 31 | ||
31 | //////////////////////////////////////////////////////////////////////// | 32 | //////////////////////////////////////////////////////////////////////// |
32 | // | 33 | // |
33 | var Montage = require("montage/core/core").Montage, | 34 | var Montage = require("montage/core/core").Montage, |
34 | Component = require("montage/ui/component").Component; | 35 | Component = require("montage/ui/component").Component; |
35 | //////////////////////////////////////////////////////////////////////// | 36 | //////////////////////////////////////////////////////////////////////// |
36 | // | 37 | // |
37 | exports.ColorModel = Montage.create(Component, { | 38 | exports.ColorModel = Montage.create(Component, { |
38 | //////////////////////////////////////////////////////////////////// | 39 | //////////////////////////////////////////////////////////////////// |
39 | // | 40 | // |
40 | hasTemplate: { | 41 | hasTemplate: { |
41 | enumerable: false, | 42 | enumerable: false, |
42 | value: false | 43 | value: false |
43 | }, | 44 | }, |
44 | //////////////////////////////////////////////////////////////////// | 45 | //////////////////////////////////////////////////////////////////// |
45 | //HSV Value of current color selected | 46 | //HSV Value of current color selected |
46 | _gradient: { | 47 | _gradient: { |
47 | enumerable: false, | 48 | enumerable: false, |
48 | value: null | 49 | value: null |
49 | }, | 50 | }, |
50 | //////////////////////////////////////////////////////////////////// | 51 | //////////////////////////////////////////////////////////////////// |
51 | //HSV Value of current color selected | 52 | //HSV Value of current color selected |
52 | gradient: { | 53 | gradient: { |
53 | enumerable: true, | 54 | enumerable: true, |
54 | get: function() { | 55 | get: function() { |
55 | return this._gradient; | 56 | return this._gradient; |
56 | }, | 57 | }, |
57 | set: function(value) { | 58 | set: function(value) { |
58 | this._gradient = value; | 59 | this._gradient = value; |
59 | //Updating color selected (converting to all modes) | 60 | //Updating color selected (converting to all modes) |
60 | this.updateColorSelected('gradient', value); | 61 | this.updateColorSelected('gradient', value); |
61 | } | 62 | } |
62 | }, | 63 | }, |
63 | //////////////////////////////////////////////////////////////////// | 64 | //////////////////////////////////////////////////////////////////// |
64 | //HSV Value of current color selected | 65 | //HSV Value of current color selected |
65 | _hsv: { | 66 | _hsv: { |
66 | enumerable: false, | 67 | enumerable: false, |
67 | value: null | 68 | value: null |
68 | }, | 69 | }, |
69 | //////////////////////////////////////////////////////////////////// | 70 | //////////////////////////////////////////////////////////////////// |
70 | //HSV Value of current color selected | 71 | //HSV Value of current color selected |
71 | hsv: { | 72 | hsv: { |
72 | enumerable: true, | 73 | enumerable: true, |
73 | get: function() { | 74 | get: function() { |
74 | return this._hsv; | 75 | return this._hsv; |
75 | }, | 76 | }, |
76 | set: function(value) { | 77 | set: function(value) { |
77 | this._hsv = value; | 78 | this._hsv = value; |
78 | //Updating color selected (converting to all modes) | 79 | //Updating color selected (converting to all modes) |
79 | this.updateColorSelected('hsv', value); | 80 | this.updateColorSelected('hsv', value); |
80 | } | 81 | } |
81 | }, | 82 | }, |
82 | //////////////////////////////////////////////////////////////////// | 83 | //////////////////////////////////////////////////////////////////// |
83 | //RGB Value of current color selected | 84 | //RGB Value of current color selected |
84 | _rgb: { | 85 | _rgb: { |
85 | enumerable: false, | 86 | enumerable: false, |
86 | value: null | 87 | value: null |
87 | }, | 88 | }, |
88 | //////////////////////////////////////////////////////////////////// | 89 | //////////////////////////////////////////////////////////////////// |
89 | //RGB Value of current color selected | 90 | //RGB Value of current color selected |
90 | rgb: { | 91 | rgb: { |
91 | enumerable: true, | 92 | enumerable: true, |
92 | get: function() { | 93 | get: function() { |
93 | return this._rgb; | 94 | return this._rgb; |
94 | }, | 95 | }, |
95 | set: function(value) { | 96 | set: function(value) { |
96 | this._rgb = value; | 97 | this._rgb = value; |
97 | //Updating color selected (converting to all modes) | 98 | //Updating color selected (converting to all modes) |
98 | this.updateColorSelected('rgb', value); | 99 | this.updateColorSelected('rgb', value); |
99 | } | 100 | } |
100 | }, | 101 | }, |
101 | //////////////////////////////////////////////////////////////////// | 102 | //////////////////////////////////////////////////////////////////// |
102 | //HSL Value of current color selected | 103 | //HSL Value of current color selected |
103 | _hsl: { | 104 | _hsl: { |
104 | enumerable: false, | 105 | enumerable: false, |
105 | value: null | 106 | value: null |
106 | }, | 107 | }, |
107 | //////////////////////////////////////////////////////////////////// | 108 | //////////////////////////////////////////////////////////////////// |
108 | //HSL Value of current color selected | 109 | //HSL Value of current color selected |
109 | hsl: { | 110 | hsl: { |
110 | enumerable: true, | 111 | enumerable: true, |
111 | get: function() { | 112 | get: function() { |
112 | return this._hsl; | 113 | return this._hsl; |
113 | }, | 114 | }, |
114 | set: function(value) { | 115 | set: function(value) { |
115 | this._hsl = value; | 116 | this._hsl = value; |
116 | //Updating color selected (converting to all modes) | 117 | //Updating color selected (converting to all modes) |
117 | this.updateColorSelected('hsl', value); | 118 | this.updateColorSelected('hsl', value); |
118 | } | 119 | } |
119 | }, | 120 | }, |
120 | //////////////////////////////////////////////////////////////////// | 121 | //////////////////////////////////////////////////////////////////// |
121 | //HEX Value of current color selected | 122 | //HEX Value of current color selected |
122 | _hex: { | 123 | _hex: { |
123 | numerable: false, | 124 | numerable: false, |
124 | value: null | 125 | value: null |
125 | }, | 126 | }, |
126 | //////////////////////////////////////////////////////////////////// | 127 | //////////////////////////////////////////////////////////////////// |
127 | //HEX Value of current color selected | 128 | //HEX Value of current color selected |
128 | hex: { | 129 | hex: { |
129 | enumerable: true, | 130 | enumerable: true, |
130 | get: function() { | 131 | get: function() { |
131 | return this._hex; | 132 | return this._hex; |
132 | }, | 133 | }, |
133 | set: function(value) { | 134 | set: function(value) { |
134 | this._hex = value; | 135 | this._hex = value; |
135 | //Updating color selected (converting to all modes) | 136 | //Updating color selected (converting to all modes) |
136 | this.updateColorSelected('hex', value); | 137 | this.updateColorSelected('hex', value); |
137 | } | 138 | } |
138 | }, | 139 | }, |
139 | //////////////////////////////////////////////////////////////////// | 140 | //////////////////////////////////////////////////////////////////// |
140 | //ALPHA Value of current color selected | 141 | //ALPHA Value of current color selected |
141 | _alpha: { | 142 | _alpha: { |
142 | enumerable: false, | 143 | enumerable: false, |
143 | value: {value: 1, type: 'change', wasSetByCode: true} | 144 | value: {value: 1, type: 'change', wasSetByCode: true} |
144 | }, | 145 | }, |
145 | //////////////////////////////////////////////////////////////////// | 146 | //////////////////////////////////////////////////////////////////// |
146 | //ALPHA Value of current color selected | 147 | //ALPHA Value of current color selected |
147 | alpha: { | 148 | alpha: { |
148 | enumerable: true, | 149 | enumerable: true, |
149 | get: function() { | 150 | get: function() { |
150 | return this._alpha; | 151 | return this._alpha; |
151 | }, | 152 | }, |
152 | set: function(value) { | 153 | set: function(value) { |
153 | value.value = Math.ceil(value.value*100)/100; | 154 | value.value = Math.ceil(value.value*100)/100; |
154 | this._alpha = value; | 155 | this._alpha = value; |
155 | // | 156 | // |