aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-06-25 11:52:28 -0700
committerJose Antonio Marquez2012-06-25 11:52:28 -0700
commitb435e97ff312eea15086069ce0ab6991acac32ff (patch)
tree542366a4fcd2df043ce91ec7a765ed18511bb70b /js
parent32c41a56fd870f28be70c9b9cfb4fe6dfbb16654 (diff)
downloadninja-b435e97ff312eea15086069ce0ab6991acac32ff.tar.gz
Color Popup Test Candidate
Preliminary check in for testing to commence on new color popup functionality.
Diffstat (limited to 'js')
-rwxr-xr-xjs/components/gradientpicker.reel/gradientpicker.js2
-rwxr-xr-xjs/components/ui/color-chip.reel/color-chip.js6
-rwxr-xr-xjs/panels/color/colorpanelbase.reel/colorpanelbase.js26
-rwxr-xr-xjs/panels/color/colorpanelpopup.reel/colorpanelpopup.js2
-rwxr-xr-xjs/panels/color/colorpopup-manager.js6
-rwxr-xr-xjs/panels/properties.reel/properties.js2
6 files changed, 26 insertions, 18 deletions
diff --git a/js/components/gradientpicker.reel/gradientpicker.js b/js/components/gradientpicker.reel/gradientpicker.js
index 9acd24ac..853d77f9 100755
--- a/js/components/gradientpicker.reel/gradientpicker.js
+++ b/js/components/gradientpicker.reel/gradientpicker.js
@@ -160,7 +160,7 @@ exports.GradientPicker = Montage.create(Component, {
160 //Initialing button with color data 160 //Initialing button with color data
161 button.color(data.color.mode, data.color.value); 161 button.color(data.color.mode, data.color.value);
162 //Button popup data 162 //Button popup data
163 button.props = {side: 'top', align: 'center', nocolor: false, wheel: true, palette: true, gradient: false, image: false, offset: -84, gradientPopup: true, history: false}; 163 button.props = {side: 'top', align: 'center', nocolor: false, wheel: true, palette: false, gradient: false, image: false, offset: -84, gradientPopup: true, history: false};
164 //Listening for color events from button 164 //Listening for color events from button
165 button.addEventListener('change', this, false); 165 button.addEventListener('change', this, false);
166 //Dispatching event depending on type of mode 166 //Dispatching event depending on type of mode
diff --git a/js/components/ui/color-chip.reel/color-chip.js b/js/components/ui/color-chip.reel/color-chip.js
index a684d0db..dd786d15 100755
--- a/js/components/ui/color-chip.reel/color-chip.js
+++ b/js/components/ui/color-chip.reel/color-chip.js
@@ -82,7 +82,11 @@ var ColorChip = exports.ColorChip = Montage.create(Component, {
82 // This is a single chip - Not related to the color panel -- Set the initial color if found 82 // This is a single chip - Not related to the color panel -- Set the initial color if found
83 var mode = "rgb", r = 0, g = 0, b = 0, a = 1, css = "rgb(0,0,0)"; 83 var mode = "rgb", r = 0, g = 0, b = 0, a = 1, css = "rgb(0,0,0)";
84 84
85 if(this.color) { 85 if(this.color && this.color.color) {
86 var g = this.color.color;
87 g.wasSetByCode = true;
88 this.chipBtn.color(this.color.mode, g);
89 } else if (this.color) {
86 var colorObj = this.application.ninja.colorController.getColorObjFromCss(this.color.css); 90 var colorObj = this.application.ninja.colorController.getColorObjFromCss(this.color.css);
87 mode = colorObj.mode; 91 mode = colorObj.mode;
88 r = colorObj.value.r; 92 r = colorObj.value.r;
diff --git a/js/panels/color/colorpanelbase.reel/colorpanelbase.js b/js/panels/color/colorpanelbase.reel/colorpanelbase.js
index bf2ada96..b3045db1 100755
--- a/js/panels/color/colorpanelbase.reel/colorpanelbase.js
+++ b/js/panels/color/colorpanelbase.reel/colorpanelbase.js
@@ -170,7 +170,7 @@ exports.ColorPanelBase = Montage.create(Component, {
170 this.addButton('current', this.btnCurrent); 170 this.addButton('current', this.btnCurrent);
171 this.addButton('previous', this.btnPrevious); 171 this.addButton('previous', this.btnPrevious);
172 // 172 //
173 this.addButton('hexinput', this.hextext); 173 this.addButton('hexinput', this.hextext, this.colorManager);
174 this.addButton('reset', this.btnDefault); 174 this.addButton('reset', this.btnDefault);
175 this.addButton('nocolor', this.btnNoColor); 175 this.addButton('nocolor', this.btnNoColor);
176 this.addButton('swap', this.btnSwap); 176 this.addButton('swap', this.btnSwap);
@@ -461,7 +461,7 @@ exports.ColorPanelBase = Montage.create(Component, {
461 //////////////////////////////////////////////////////////////////// 461 ////////////////////////////////////////////////////////////////////
462 // 462 //
463 addButton: { 463 addButton: {
464 value: function (type, button) { 464 value: function (type, button, manager) {
465 // 465 //
466 switch (type.toLocaleLowerCase()) { 466 switch (type.toLocaleLowerCase()) {
467 case 'chip': 467 case 'chip':
@@ -487,7 +487,7 @@ exports.ColorPanelBase = Montage.create(Component, {
487 } 487 }
488 } else { 488 } else {
489 this.drawNoColor(this, this.cvs); 489 this.drawNoColor(this, this.cvs);
490 } 490 }9
491 this.colorValue = c; 491 this.colorValue = c;
492 this.colorMode = m; 492 this.colorMode = m;
493 this.otherInput = false; 493 this.otherInput = false;
@@ -677,8 +677,8 @@ exports.ColorPanelBase = Montage.create(Component, {
677 case 'hexinput': 677 case 'hexinput':
678 var hexinp = HotText.create(); 678 var hexinp = HotText.create();
679 hexinp.element = button; 679 hexinp.element = button;
680 hexinp.labelFunction = this._updateHexValue.bind(this); 680 hexinp.labelFunction = this._updateHexValue.bind(manager);
681 hexinp.inputFunction = this._hottextHexInput.bind(this); 681 hexinp.inputFunction = this._hottextHexInput.bind(manager);
682 hexinp.needsDraw = true; 682 hexinp.needsDraw = true;
683 this._buttons.hexinput.push(hexinp); 683 this._buttons.hexinput.push(hexinp);
684 return hexinp; 684 return hexinp;
@@ -1248,23 +1248,23 @@ exports.ColorPanelBase = Montage.create(Component, {
1248 } 1248 }
1249 //Checking for panel mode and converting the color to the panel mode 1249 //Checking for panel mode and converting the color to the panel mode
1250 if (this._panelMode === 'hsl') { 1250 if (this._panelMode === 'hsl') {
1251 rgb = this.colorManager.hexToRgb(color); 1251 rgb = this.hexToRgb(color);
1252 if (rgb) { 1252 if (rgb) {
1253 update = this.colorManager.rgbToHsl(rgb.r, rgb.g, rgb.b); 1253 update = this.rgbToHsl(rgb.r, rgb.g, rgb.b);
1254 update.wasSetByCode = false; 1254 update.wasSetByCode = false;
1255 update.type = 'change'; 1255 update.type = 'change';
1256 this.colorManager.hsl = update; 1256 this.hsl = update;
1257 } else { 1257 } else {
1258 this.colorManager.applyNoColor(false); 1258 this.applyNoColor(false);
1259 } 1259 }
1260 } else { 1260 } else {
1261 update = this.colorManager.hexToRgb(color); 1261 update = this.hexToRgb(color);
1262 if (update) { 1262 if (update) {
1263 update.wasSetByCode = false; 1263 update.wasSetByCode = false;
1264 update.type = 'change'; 1264 update.type = 'change';
1265 this.colorManager.rgb = update; 1265 this.rgb = update;
1266 } else { 1266 } else {
1267 this.colorManager.applyNoColor(false); 1267 this.applyNoColor(false);
1268 } 1268 }
1269 } 1269 }
1270 } 1270 }
@@ -1273,7 +1273,7 @@ exports.ColorPanelBase = Montage.create(Component, {
1273 // 1273 //
1274 _updateHexValue: { 1274 _updateHexValue: {
1275 value: function (v) { 1275 value: function (v) {
1276 return this.colorManager.hex; 1276 return this.hex;
1277 } 1277 }
1278 }, 1278 },
1279 //////////////////////////////////////////////////////////////////// 1279 ////////////////////////////////////////////////////////////////////
diff --git a/js/panels/color/colorpanelpopup.reel/colorpanelpopup.js b/js/panels/color/colorpanelpopup.reel/colorpanelpopup.js
index 179dc02c..c0d8118f 100755
--- a/js/panels/color/colorpanelpopup.reel/colorpanelpopup.js
+++ b/js/panels/color/colorpanelpopup.reel/colorpanelpopup.js
@@ -153,7 +153,7 @@ exports.ColorPanelPopup = Montage.create(Component, {
153 this.btnGradient.style.display = 'none'; 153 this.btnGradient.style.display = 'none';
154 } 154 }
155 // 155 //
156 this.application.ninja.colorController.colorView.addButton('hexinput', this.inputHex); 156 this.application.ninja.colorController.colorView.addButton('hexinput', this.inputHex, this.colorManager);
157 // 157 //
158 this._components.combo.slider.needsDraw = true; 158 this._components.combo.slider.needsDraw = true;
159 this._components.combo.hottext.needsDraw = true; 159 this._components.combo.hottext.needsDraw = true;
diff --git a/js/panels/color/colorpopup-manager.js b/js/panels/color/colorpopup-manager.js
index 0ea02192..15d55787 100755
--- a/js/panels/color/colorpopup-manager.js
+++ b/js/panels/color/colorpopup-manager.js
@@ -217,6 +217,8 @@ exports.ColorPopupManager = Montage.create(Component, {
217 colorChipChange: { 217 colorChipChange: {
218 value: function (e) { 218 value: function (e) {
219 // 219 //
220 if (!this._popupChipBtn) return;
221 //
220 var ctx, 222 var ctx,
221 cvs = this._popupChipBtn.getElementsByTagName('canvas')[0], 223 cvs = this._popupChipBtn.getElementsByTagName('canvas')[0],
222 rgb = this._popupChipBase.colorManager.rgb, 224 rgb = this._popupChipBase.colorManager.rgb,
@@ -254,6 +256,8 @@ exports.ColorPopupManager = Montage.create(Component, {
254 colorGradientChipChange: { 256 colorGradientChipChange: {
255 value: function (e) { 257 value: function (e) {
256 // 258 //
259 if (!this._popupGradientChipBtn) return;
260 //
257 var ctx, 261 var ctx,
258 cvs = this._popupGradientChipBtn.getElementsByTagName('canvas')[0], 262 cvs = this._popupGradientChipBtn.getElementsByTagName('canvas')[0],
259 rgb = this._popupGradientChipBase.colorManager.rgb, 263 rgb = this._popupGradientChipBase.colorManager.rgb,
@@ -403,7 +407,7 @@ exports.ColorPopupManager = Montage.create(Component, {
403 if (e._event.srcElement.props) { 407 if (e._event.srcElement.props) {
404 this._popupGradientChipBase.props = e._event.srcElement.props; 408 this._popupGradientChipBase.props = e._event.srcElement.props;
405 } else { 409 } else {
406 this._popupGradientChipBase.props = {side: 'top', align: 'center', wheel: true, palette: true, gradient: false, image: false, nocolor: true, history: false}; 410 this._popupGradientChipBase.props = {side: 'top', align: 'center', wheel: true, palette: true, gradient: false, image: false, nocolor: false, history: false};
407 } 411 }
408 // 412 //
409 if (this._popupGradientChipBase.props.offset) { 413 if (this._popupGradientChipBase.props.offset) {
diff --git a/js/panels/properties.reel/properties.js b/js/panels/properties.reel/properties.js
index 5719a63d..c8383307 100755
--- a/js/panels/properties.reel/properties.js
+++ b/js/panels/properties.reel/properties.js
@@ -373,7 +373,7 @@ exports.Properties = Montage.create(Component, {
373 } 373 }
374 } 374 }
375 } 375 }
376 376 if (previousInput === 'chip') return;
377 this.application.ninja.colorController.colorModel.input = previousInput; 377 this.application.ninja.colorController.colorModel.input = previousInput;
378 var color = this.application.ninja.colorController.colorModel.colorHistory[previousInput][this.application.ninja.colorController.colorModel.colorHistory[previousInput].length-1]; 378 var color = this.application.ninja.colorController.colorModel.colorHistory[previousInput][this.application.ninja.colorController.colorModel.colorHistory[previousInput].length-1];
379 color.c.wasSetByCode = true; 379 color.c.wasSetByCode = true;