diff options
author | John Mayhew | 2012-04-02 16:28:39 -0700 |
---|---|---|
committer | John Mayhew | 2012-04-02 16:28:39 -0700 |
commit | b4155fb4c33675a8a7cd37473513718043fdf0ba (patch) | |
tree | 3d8c802473f2395d53d599ec9d8b70b60a4db50c /js/panels/color/colorchippopup.reel/colorchippopup.js | |
parent | 5ba9aeac94c86049423fd5d4b37b277263939c13 (diff) | |
parent | c6de22bf42be90b403491b5f87b1818d9020310c (diff) | |
download | ninja-b4155fb4c33675a8a7cd37473513718043fdf0ba.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into WorkingBranch
Conflicts:
js/helper-classes/RDGE/rdge-compiled.js
js/helper-classes/RDGE/runtime/GLRuntime.js
js/helper-classes/RDGE/src/core/script/MeshManager.js
js/helper-classes/RDGE/src/core/script/engine.js
js/helper-classes/RDGE/src/core/script/fx/ssao.js
js/helper-classes/RDGE/src/core/script/init_state.js
js/helper-classes/RDGE/src/core/script/run_state.js
js/helper-classes/RDGE/src/core/script/scenegraphNodes.js
js/helper-classes/RDGE/src/core/script/utilities.js
js/helper-classes/RDGE/src/tools/compile-rdge-core.bat
js/helper-classes/RDGE/src/tools/compile-rdge-core.sh
js/helper-classes/RDGE/src/tools/rdge-compiled.js
js/lib/drawing/world.js
js/lib/rdge/materials/bump-metal-material.js
js/lib/rdge/materials/deform-material.js
js/lib/rdge/materials/flat-material.js
js/lib/rdge/materials/fly-material.js
js/lib/rdge/materials/julia-material.js
js/lib/rdge/materials/keleidoscope-material.js
js/lib/rdge/materials/linear-gradient-material.js
js/lib/rdge/materials/mandel-material.js
js/lib/rdge/materials/plasma-material.js
js/lib/rdge/materials/pulse-material.js
js/lib/rdge/materials/radial-blur-material.js
js/lib/rdge/materials/radial-gradient-material.js
js/lib/rdge/materials/relief-tunnel-material.js
js/lib/rdge/materials/square-tunnel-material.js
js/lib/rdge/materials/star-material.js
js/lib/rdge/materials/taper-material.js
js/lib/rdge/materials/tunnel-material.js
js/lib/rdge/materials/twist-material.js
js/lib/rdge/materials/twist-vert-material.js
js/lib/rdge/materials/uber-material.js
js/lib/rdge/materials/water-material.js
js/lib/rdge/materials/z-invert-material.js
js/preloader/Preloader.js
Diffstat (limited to 'js/panels/color/colorchippopup.reel/colorchippopup.js')
-rwxr-xr-x | js/panels/color/colorchippopup.reel/colorchippopup.js | 589 |
1 files changed, 589 insertions, 0 deletions
diff --git a/js/panels/color/colorchippopup.reel/colorchippopup.js b/js/panels/color/colorchippopup.reel/colorchippopup.js new file mode 100755 index 00000000..414be8b7 --- /dev/null +++ b/js/panels/color/colorchippopup.reel/colorchippopup.js | |||
@@ -0,0 +1,589 @@ | |||
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 (e) { | ||
47 | this.colorManager.applyNoColor(); | ||
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 | // | ||