diff options
author | Kruti Shah | 2012-07-03 10:08:44 -0700 |
---|---|---|
committer | Kruti Shah | 2012-07-03 10:08:44 -0700 |
commit | bf5e6d6febf0c15a00e7694d7fa2c85b0cf567fe (patch) | |
tree | 006f6243962aa2e2b59f688cf37b16162376dc39 /js/panels/color/colorchippopup.reel/colorchippopup.js | |
parent | 3aa1242147264351b7d827fa25ecb5dc42bc2fb0 (diff) | |
parent | 12de4e49a309e210c13eb40b2ffa158ef2eb54a7 (diff) | |
download | ninja-bf5e6d6febf0c15a00e7694d7fa2c85b0cf567fe.tar.gz |
Merge branch 'refs/heads/ninjainternalmaster' into Timeline-local-kruti
Conflicts:
js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
Signed-off-by: Kruti Shah <kruti.shah@motorola.com>
Diffstat (limited to 'js/panels/color/colorchippopup.reel/colorchippopup.js')
-rwxr-xr-x | js/panels/color/colorchippopup.reel/colorchippopup.js | 589 |
1 files changed, 0 insertions, 589 deletions
diff --git a/js/panels/color/colorchippopup.reel/colorchippopup.js b/js/panels/color/colorchippopup.reel/colorchippopup.js deleted file mode 100755 index 923beca9..00000000 --- a/js/panels/color/colorchippopup.reel/colorchippopup.js +++ /dev/null | |||
@@ -1,589 +0,0 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | //////////////////////////////////////////////////////////////////////// | ||
8 | // | ||
9 | var Montage = require("montage/core/core").Montage, | ||
10 | Component = require("montage/ui/component").Component, | ||
11 | Slider = require("js/components/slider.reel").Slider, | ||
12 | HotText = require("js/components/hottext.reel").HotText, | ||
13 | ColorWheel = require("js/components/colorwheel.reel").ColorWheel, | ||
14 | GradientPicker = require("js/components/gradientpicker.reel").GradientPicker; | ||
15 | //////////////////////////////////////////////////////////////////////// | ||
16 | //Exporting as ColorPanelPopup | ||
17 | exports.ColorChipPopup = Montage.create(Component, { | ||
18 | //////////////////////////////////////////////////////////////////// | ||
19 | // | ||
20 | hasTemplate: { | ||
21 | value: true | ||
22 | }, | ||
23 | //////////////////////////////////////////////////////////////////// | ||
24 | //Storing color manager | ||
25 | _colorManager: { | ||
26 | enumerable: false, | ||
27 | value: false | ||
28 | }, | ||
29 | //////////////////////////////////////////////////////////////////// | ||
30 | //Color manager | ||
31 | colorManager: { | ||
32 | enumerable: true, | ||
33 | get: function() { | ||
34 | return this._colorManager; | ||
35 | }, | ||
36 | set: function(value) { | ||
37 | if (value !== this._colorManager) { | ||
38 | this._colorManager = value; | ||
39 | } | ||
40 | } | ||
41 | }, | ||
42 | //////////////////////////////////////////////////////////////////// | ||
43 | // | ||
44 | setNoColor: { | ||
45 | enumerable: true, | ||
46 | value: function (code) { | ||
47 | this.colorManager.applyNoColor(code); | ||
48 | } | ||
49 | }, | ||
50 | //////////////////////////////////////////////////////////////////// | ||
51 | // | ||
52 | _colorChipWheel: { | ||
53 | enumerable: false, | ||
54 | value: null | ||
55 | }, | ||
56 | //////////////////////////////////////////////////////////////////// | ||
57 | // | ||
58 | popupContainers: { | ||
59 | enumerable: true, | ||
60 | value: {wheel: null, palette: null, gradient: null, image: null} | ||
61 | }, | ||
62 | //////////////////////////////////////////////////////////////////// | ||
63 | // | ||
64 | popupModes: { | ||
65 | enumerable: true, | ||
66 | value: {wheel: true, palette: true, gradient: true, image: true, nocolor: true} | ||
67 | }, | ||
68 | //////////////////////////////////////////////////////////////////// | ||
69 | // | ||
70 | hexInput: { | ||
71 | enumerable: true, | ||
72 | value: null | ||
73 | }, | ||
74 | //////////////////////////////////////////////////////////////////// | ||
75 | // | ||
76 | prepareForDraw: { | ||
77 | enumerable: false, | ||
78 | value: function () { | ||
79 | //Storing containers for reference | ||
80 | this.popupContainers.wheel = document.getElementById('cc_pu_wheel_container'); | ||
81 | this.popupContainers.palette = document.getElementById("cc_pu_palette_container"); | ||
82 | this.popupContainers.gradient = document.getElementById("cc_pu_gradient_container"); | ||
83 | this.popupContainers.image = document.getElementById("cc_pu_image_container"); | ||
84 | this.popupContainers.alpha = document.getElementById("cc_pu_alpha"); | ||
85 | // | ||
86 | |||
87 | this.colorManager.addEventListener('change', function (e) { | ||
88 | // | ||
89 | }.bind(this)); | ||
90 | } | ||
91 | }, | ||
92 | //////////////////////////////////////////////////////////////////// | ||
93 | // | ||
94 | willDraw: { | ||
95 | enumerable: false, | ||
96 | value: function() { | ||
97 | // | ||
98 | this.element.style.opacity = 0; | ||
99 | // | ||
100 | this.combo = {}; | ||
101 | this.combo.slider = Slider.create(); | ||
102 | this.combo.hottext = HotText.create(); | ||
103 | this.combo.slider.element = document.getElementById('cc_pu_a_slider'); | ||
104 | this.combo.hottext.element = document.getElementById('cc_pu_a_hottext'); | ||
105 | // | ||
106 | this.cc_hexinput = HotText.create(); | ||
107 | this.cc_hexinput.element = document.getElementById('cc_pu_hottext_hex'); | ||
108 | this.cc_hexinput.labelFunction = this._hexLabel.bind(this); | ||
109 | this.cc_hexinput.inputFunction = this._hexInput.bind(this); | ||
110 | // | ||
111 | if (this.application.ninja.colorController.colorView.currentChip && this.application.ninja.colorController.colorView.currentChip.colorValue && this.application.ninja.colorController.colorView.currentChip.colorValue.a) { | ||
112 | this.combo.slider.value = Math.round(this.application.ninja.colorController.colorView.currentChip.colorValue.a*100); | ||
113 | } else { | ||
114 | this.combo.slider.value = 100; | ||
115 | } | ||
116 | this.application.ninja.colorController.colorModel._alpha = {value: this.combo.slider.value/100, wasSetByCode: true, type: 'change'}; | ||
117 | // | ||
118 | Object.defineBinding(this.combo.hottext, "value", { | ||
119 | boundObject: this.combo.slider, | ||
120 | boundObjectPropertyPath: "value", | ||
121 | oneway: false, | ||
122 | boundValueMutator: function(value) { | ||
123 | return Math.round(value); | ||
124 | } | ||
125 | }); | ||
126 | // | ||
127 | this.combo.slider.maxValue = this.combo.hottext.maxValue = 100; | ||
128 | this.combo.slider.customBackground = this.application.ninja.colorController.colorView._slider3Background.bind(this.application.ninja.colorController.colorView); | ||
129 | // | ||
130 | this.combo.slider.addEventListener('change', this.alphaChange.bind(this)); | ||
131 | this.combo.hottext.addEventListener('change', this.alphaChange.bind(this)); | ||
132 | // | ||
133 | this._colorChipWheel = ColorWheel.create(); | ||
134 | this._colorChipWheel.element = this.popupContainers.wheel; | ||
135 | this._colorChipWheel.element.style.display = 'block'; | ||
136 | this._colorChipWheel.rimWidth = 14; | ||
137 | this._colorChipWheel.strokeWidth = 2; | ||
138 | // | ||
139 | this._colorChipWheel.addEventListener('firstDraw', this, false); | ||
140 | this._colorChipWheel.addEventListener('change', this, false); | ||
141 | this._colorChipWheel.addEventListener('changing', this, false); | ||
142 | } | ||
143 | }, | ||
144 | //////////////////////////////////////////////////////////////////// | ||
145 | // | ||
146 | draw: { | ||
147 | enumerable: false, | ||
148 | value: function() { | ||
149 | // | ||
150 | this.drawPalette(this.defaultPalette); | ||
151 | // | ||
152 | //this.cc_hexinput = this.application.ninja.colorController.colorView.addButton('hexinput', document.getElementById('cc_pu_hottext_hex')); | ||
153 | // | ||
154 | this.combo.slider.needsDraw = true; | ||
155 | this.combo.hottext.needsDraw = true; | ||
156 | this.cc_hexinput.needsDraw = true; | ||
157 | // | ||
158 | var ncButton = document.getElementById('cc_pu_nocolor'), | ||
159 | plButton = document.getElementById('cc_pu_palettes'), | ||
160 | wlButton = document.getElementById('cc_pu_wheel'), | ||
161 | gdButton = document.getElementById('cc_pu_gradients'), | ||
162 | imButton = document.getElementById('cc_pu_images'); | ||
163 | // | ||
164 | if (this.popupModes.nocolor) { | ||
165 | ncButton.addEventListener('click', function () { | ||
166 | this.setNoColor(); | ||
167 | }.bind(this)); | ||
168 | } else { | ||
169 | ncButton.style.display = 'none'; | ||
170 | } | ||
171 | // | ||
172 | if (this.popupModes.palette) { | ||
173 | plButton.addEventListener('click', function () { | ||
174 | this.popupSwitchInputTo(this.popupContainers.palette); | ||
175 | }.bind(this)); | ||
176 | } else { | ||
177 | plButton.style.display = 'none'; | ||
178 | } | ||
179 | // | ||
180 | if (this.popupModes.wheel) { | ||
181 | wlButton.addEventListener('click', function () { | ||
182 | this.popupSwitchInputTo(this.popupContainers.wheel); | ||
183 | }.bind(this)); | ||
184 | } else { | ||
185 | wlButton.style.display = 'none'; | ||
186 | } | ||
187 | // | ||
188 | if (this.popupModes.gradient) { | ||
189 | gdButton.addEventListener('click', function () { | ||
190 | this.popupSwitchInputTo(this.popupContainers.gradient); | ||
191 | }.bind(this)); | ||
192 | } else { | ||
193 | gdButton.style.display = 'none'; | ||
194 | } | ||
195 | // | ||
196 | if (this.popupModes.image) { | ||
197 | imButton.style.opacity = .2;//TODO: Remove, visual feedback for disable button | ||
198 | imButton.addEventListener('click', function () { | ||
199 | //this.popupSwitchInputTo(this.popupContainers.image); | ||
200 | }.bind(this)); | ||