diff options
Diffstat (limited to 'js/models/color-model.js')
-rwxr-xr-x | js/models/color-model.js | 742 |
1 files changed, 371 insertions, 371 deletions
diff --git a/js/models/color-model.js b/js/models/color-model.js index cc41b59e..1fb2ba9c 100755 --- a/js/models/color-model.js +++ b/js/models/color-model.js | |||
@@ -30,426 +30,426 @@ POSSIBILITY OF SUCH DAMAGE. | |||
30 | 30 | ||
31 | //////////////////////////////////////////////////////////////////////// | 31 | //////////////////////////////////////////////////////////////////////// |
32 | // | 32 | // |
33 | var Montage = require("montage/core/core").Montage, | 33 | var Montage = require("montage/core/core").Montage, |
34 | Component = require("montage/ui/component").Component; | 34 | Component = require("montage/ui/component").Component; |
35 | //////////////////////////////////////////////////////////////////////// | 35 | //////////////////////////////////////////////////////////////////////// |
36 | // | 36 | // |
37 | exports.ColorModel = Montage.create(Component, { | 37 | exports.ColorModel = Montage.create(Component, { |
38 | //////////////////////////////////////////////////////////////////// | 38 | //////////////////////////////////////////////////////////////////// |
39 | // | 39 | // |
40 | hasTemplate: { | 40 | hasTemplate: { |
41 | enumerable: false, | 41 | enumerable: false, |
42 | value: false | 42 | value: false |
43 | }, | 43 | }, |
44 | //////////////////////////////////////////////////////////////////// | 44 | //////////////////////////////////////////////////////////////////// |
45 | //HSV Value of current color selected | 45 | //HSV Value of current color selected |
46 | _gradient: { | 46 | _gradient: { |
47 | enumerable: false, | 47 | enumerable: false, |
48 | value: null | 48 | value: null |
49 | }, | 49 | }, |
50 | //////////////////////////////////////////////////////////////////// | 50 | //////////////////////////////////////////////////////////////////// |
51 | //HSV Value of current color selected | 51 | //HSV Value of current color selected |
52 | gradient: { | 52 | gradient: { |
53 | enumerable: true, | 53 | enumerable: true, |
54 | get: function() { | 54 | get: function() { |
55 | return this._gradient; | 55 | return this._gradient; |
56 | }, | 56 | }, |
57 | set: function(value) { | 57 | set: function(value) { |
58 | this._gradient = value; | 58 | this._gradient = value; |
59 | //Updating color selected (converting to all modes) | 59 | //Updating color selected (converting to all modes) |
60 | this.updateColorSelected('gradient', value); | 60 | this.updateColorSelected('gradient', value); |
61 | } | 61 | } |
62 | }, | 62 | }, |
63 | //////////////////////////////////////////////////////////////////// | 63 | //////////////////////////////////////////////////////////////////// |
64 | //HSV Value of current color selected | 64 | //HSV Value of current color selected |
65 | _hsv: { | 65 | _hsv: { |
66 | enumerable: false, | 66 | enumerable: false, |
67 | value: null | 67 | value: null |
68 | }, | 68 | }, |
69 | //////////////////////////////////////////////////////////////////// | 69 | //////////////////////////////////////////////////////////////////// |
70 | //HSV Value of current color selected | 70 | //HSV Value of current color selected |
71 | hsv: { | 71 | hsv: { |
72 | enumerable: true, | 72 | enumerable: true, |
73 | get: function() { | 73 | get: function() { |
74 | return this._hsv; | 74 | return this._hsv; |
75 | }, | 75 | }, |
76 | set: function(value) { | 76 | set: function(value) { |
77 | this._hsv = value; | 77 | this._hsv = value; |
78 | //Updating color selected (converting to all modes) | 78 | //Updating color selected (converting to all modes) |
79 | this.updateColorSelected('hsv', value); | 79 | this.updateColorSelected('hsv', value); |
80 | } | 80 | } |
81 | }, | 81 | }, |
82 | //////////////////////////////////////////////////////////////////// | 82 | //////////////////////////////////////////////////////////////////// |
83 | //RGB Value of current color selected | 83 | //RGB Value of current color selected |
84 | _rgb: { | 84 | _rgb: { |
85 | enumerable: false, | 85 | enumerable: false, |
86 | value: null | 86 | value: null |
87 | }, | 87 | }, |
88 | //////////////////////////////////////////////////////////////////// | 88 | //////////////////////////////////////////////////////////////////// |
89 | //RGB Value of current color selected | 89 | //RGB Value of current color selected |
90 | rgb: { | 90 | rgb: { |
91 | enumerable: true, | 91 | enumerable: true, |
92 | get: function() { | 92 | get: function() { |
93 | return this._rgb; | 93 | return this._rgb; |
94 | }, | 94 | }, |
95 | set: function(value) { | 95 | set: function(value) { |
96 | this._rgb = value; | 96 | this._rgb = value; |
97 | //Updating color selected (converting to all modes) | 97 | //Updating color selected (converting to all modes) |
98 | this.updateColorSelected('rgb', value); | 98 | this.updateColorSelected('rgb', value); |
99 | } | 99 | } |
100 | }, | 100 | }, |
101 | //////////////////////////////////////////////////////////////////// | 101 | //////////////////////////////////////////////////////////////////// |
102 | //HSL Value of current color selected | 102 | //HSL Value of current color selected |
103 | _hsl: { | 103 | _hsl: { |
104 | enumerable: false, | 104 | enumerable: false, |
105 | value: null | 105 | value: null |
106 | }, | 106 | }, |
107 | //////////////////////////////////////////////////////////////////// | 107 | //////////////////////////////////////////////////////////////////// |
108 | //HSL Value of current color selected | 108 | //HSL Value of current color selected |
109 | hsl: { | 109 | hsl: { |
110 | enumerable: true, | 110 | enumerable: true, |
111 | get: function() { | 111 | get: function() { |
112 | return this._hsl; | 112 | return this._hsl; |
113 | }, | 113 | }, |
114 | set: function(value) { | 114 | set: function(value) { |
115 | this._hsl = value; | 115 | this._hsl = value; |
116 | //Updating color selected (converting to all modes) | 116 | //Updating color selected (converting to all modes) |
117 | this.updateColorSelected('hsl', value); | 117 | this.updateColorSelected('hsl', value); |
118 | } | 118 | } |
119 | }, | 119 | }, |
120 | //////////////////////////////////////////////////////////////////// | 120 | //////////////////////////////////////////////////////////////////// |
121 | //HEX Value of current color selected | 121 | //HEX Value of current color selected |
122 | _hex: { | 122 | _hex: { |
123 | numerable: false, | 123 | numerable: false, |
124 | value: null | 124 | value: null |
125 | }, | 125 | }, |
126 | //////////////////////////////////////////////////////////////////// | 126 | //////////////////////////////////////////////////////////////////// |
127 | //HEX Value of current color selected | 127 | //HEX Value of current color selected |
128 | hex: { | 128 | hex: { |
129 | enumerable: true, | 129 | enumerable: true, |
130 | get: function() { | 130 | get: function() { |
131 | return this._hex; | 131 | return this._hex; |
132 | }, | 132 | }, |
133 | set: function(value) { | 133 | set: function(value) { |
134 | this._hex = value; | 134 | this._hex = value; |
135 | //Updating color selected (converting to all modes) | 135 | //Updating color selected (converting to all modes) |
136 | this.updateColorSelected('hex', value); | 136 | this.updateColorSelected('hex', value); |
137 | } | 137 | } |
138 | }, | 138 | }, |
139 | //////////////////////////////////////////////////////////////////// | 139 | //////////////////////////////////////////////////////////////////// |
140 | //ALPHA Value of current color selected | 140 | //ALPHA Value of current color selected |
141 | _alpha: { | 141 | _alpha: { |
142 | enumerable: false, | 142 | enumerable: false, |
143 | value: {value: 1, type: 'change', wasSetByCode: true} | 143 | value: {value: 1, type: 'change', wasSetByCode: true} |
144 | }, | 144 | }, |
145 | //////////////////////////////////////////////////////////////////// | 145 | //////////////////////////////////////////////////////////////////// |
146 | //ALPHA Value of current color selected | 146 | //ALPHA Value of current color selected |
147 | alpha: { | 147 | alpha: { |
148 | enumerable: true, | 148 | enumerable: true, |
149 | get: function() { | 149 | get: function() { |
150 | return this._alpha; | 150 | return this._alpha; |
151 | }, | 151 | }, |
152 | set: function(value) { | 152 | set: function(value) { |
153 | value.value = Math.ceil(value.value*100)/100; | 153 | value.value = Math.ceil(value.value*100)/100; |
154 | this._alpha = value; | 154 | this._alpha = value; |
155 | // | 155 | // |
156 | if (this.rgb || this.hsl) { | 156 | if (this.rgb || this.hsl) { |
157 | this._dispatchChangeEvent('alpha', value); | 157 | this._dispatchChangeEvent('alpha', value); |
158 | } | 158 | } |
159 | } | 159 | } |
160 | }, | 160 | }, |
161 | //////////////////////////////////////////////////////////////////// | 161 | //////////////////////////////////////////////////////////////////// |
162 | //Input (fill or stroke) Value of current color selected | 162 | //Input (fill or stroke) Value of current color selected |
163 | _input: { | 163 | _input: { |
164 | enumerable: false, | 164 | enumerable: false, |
165 | value: 'fill' | 165 | value: 'fill' |
166 | }, | 166 | }, |
167 | //////////////////////////////////////////////////////////////////// | 167 | //////////////////////////////////////////////////////////////////// |
168 | //Input Value of current color selected | 168 | //Input Value of current color selected |
169 | input: { | 169 | input: { |
170 | enumerable: true, | 170 | enumerable: true, |
171 | get: function() { | 171 | get: function() { |
172 | return this._input; | 172 | return this._input; |
173 | }, | 173 | }, |
174 | set: function(value) { | 174 | set: function(value) { |
175 | this._input = value; | 175 | this._input = value; |
176 | //Dispatching change event | 176 | //Dispatching change event |
177 | this._dispatchChangeEvent('input', value); | 177 | this._dispatchChangeEvent('input', value); |
178 | } | 178 | } |
179 | }, | 179 | }, |
180 | //////////////////////////////////////////////////////////////////// | 180 | //////////////////////////////////////////////////////////////////// |
181 | //Color mode of current color selected | 181 | //Color mode of current color selected |
182 | _mode: { | 182 | _mode: { |
183 | enumerable: false, | 183 | enumerable: false, |
184 | value: null | 184 | value: null |
185 | }, | 185 | }, |
186 | //////////////////////////////////////////////////////////////////// | 186 | //////////////////////////////////////////////////////////////////// |
187 | //Color mode of current color selected | 187 | //Color mode of current color selected |
188 | mode: { |