diff options
Diffstat (limited to 'js/panels/color/colorpanelbase.reel/colorpanelbase.js')
-rwxr-xr-x | js/panels/color/colorpanelbase.reel/colorpanelbase.js | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/js/panels/color/colorpanelbase.reel/colorpanelbase.js b/js/panels/color/colorpanelbase.reel/colorpanelbase.js index 26d4932f..24eb86ea 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': |
@@ -480,7 +480,13 @@ exports.ColorPanelBase = Montage.create(Component, { | |||
480 | } | 480 | } |
481 | if (c && c.css) { | 481 | if (c && c.css) { |
482 | this.ctx.clearRect(0, 0, this.cvs.width, this.cvs.height); | 482 | this.ctx.clearRect(0, 0, this.cvs.width, this.cvs.height); |
483 | this.style.backgroundColor = c.css; | 483 | if (m === 'gradient') { |
484 | this.style.backgroundImage = c.css; | ||
485 | this.style.backgroundColor = 'transparent'; | ||
486 | } else { | ||
487 | this.style.backgroundColor = c.css; | ||
488 | this.style.backgroundImage = 'none'; | ||
489 | } | ||
484 | } else { | 490 | } else { |
485 | this.drawNoColor(this, this.cvs); | 491 | this.drawNoColor(this, this.cvs); |
486 | } | 492 | } |
@@ -673,8 +679,8 @@ exports.ColorPanelBase = Montage.create(Component, { | |||
673 | case 'hexinput': | 679 | case 'hexinput': |
674 | var hexinp = HotText.create(); | 680 | var hexinp = HotText.create(); |
675 | hexinp.element = button; | 681 | hexinp.element = button; |
676 | hexinp.labelFunction = this._updateHexValue.bind(this); | 682 | hexinp.labelFunction = this._updateHexValue.bind(manager); |
677 | hexinp.inputFunction = this._hottextHexInput.bind(this); | 683 | hexinp.inputFunction = this._hottextHexInput.bind(manager); |
678 | hexinp.needsDraw = true; | 684 | hexinp.needsDraw = true; |
679 | this._buttons.hexinput.push(hexinp); | 685 | this._buttons.hexinput.push(hexinp); |
680 | return hexinp; | 686 | return hexinp; |
@@ -1244,23 +1250,23 @@ exports.ColorPanelBase = Montage.create(Component, { | |||
1244 | } | 1250 | } |
1245 | //Checking for panel mode and converting the color to the panel mode | 1251 | //Checking for panel mode and converting the color to the panel mode |
1246 | if (this._panelMode === 'hsl') { | 1252 | if (this._panelMode === 'hsl') { |
1247 | rgb = this.colorManager.hexToRgb(color); | 1253 | rgb = this.hexToRgb(color); |
1248 | if (rgb) { | 1254 | if (rgb) { |
1249 | update = this.colorManager.rgbToHsl(rgb.r, rgb.g, rgb.b); | 1255 | update = this.rgbToHsl(rgb.r, rgb.g, rgb.b); |
1250 | update.wasSetByCode = false; | 1256 | update.wasSetByCode = false; |
1251 | update.type = 'change'; | 1257 | update.type = 'change'; |
1252 | this.colorManager.hsl = update; | 1258 | this.hsl = update; |
1253 | } else { | 1259 | } else { |
1254 | this.colorManager.applyNoColor(false); | 1260 | this.applyNoColor(false); |
1255 | } | 1261 | } |
1256 | } else { | 1262 | } else { |
1257 | update = this.colorManager.hexToRgb(color); | 1263 | update = this.hexToRgb(color); |
1258 | if (update) { | 1264 | if (update) { |
1259 | update.wasSetByCode = false; | 1265 | update.wasSetByCode = false; |
1260 | update.type = 'change'; | 1266 | update.type = 'change'; |
1261 | this.colorManager.rgb = update; | 1267 | this.rgb = update; |
1262 | } else { | 1268 | } else { |
1263 | this.colorManager.applyNoColor(false); | 1269 | this.applyNoColor(false); |
1264 | } | 1270 | } |
1265 | } | 1271 | } |
1266 | } | 1272 | } |
@@ -1269,7 +1275,7 @@ exports.ColorPanelBase = Montage.create(Component, { | |||
1269 | // | 1275 | // |
1270 | _updateHexValue: { | 1276 | _updateHexValue: { |
1271 | value: function (v) { | 1277 | value: function (v) { |
1272 | return this.colorManager.hex; | 1278 | return this.hex; |
1273 | } | 1279 | } |
1274 | }, | 1280 | }, |
1275 | //////////////////////////////////////////////////////////////////// | 1281 | //////////////////////////////////////////////////////////////////// |
@@ -1415,6 +1421,10 @@ exports.ColorPanelBase = Montage.create(Component, { | |||
1415 | // | 1421 | // |
1416 | selectInputType: { | 1422 | selectInputType: { |
1417 | value: function (type) { | 1423 | value: function (type) { |
1424 | if (this.colorManager.input === 'chip') { | ||
1425 | this.application.ninja.colorController.colorPopupManager.hideColorPopup(); | ||
1426 | return; | ||
1427 | } | ||
1418 | //Checking for the type to be formatted as expected, otherwise we unselected all buttons | 1428 | //Checking for the type to be formatted as expected, otherwise we unselected all buttons |
1419 | try { | 1429 | try { |
1420 | type._event.srcElement.inputType; | 1430 | type._event.srcElement.inputType; |