diff options
author | Kris Kowal | 2012-07-06 11:52:06 -0700 |
---|---|---|
committer | Kris Kowal | 2012-07-06 15:01:48 -0700 |
commit | 648ee61ae84216d0236e0dbc211addc13b2cfa3a (patch) | |
tree | 8f0f55557bd0c47a84e49c1977c950645d284607 /js/panels/color/colorpanelbase.reel/colorpanelbase.js | |
parent | aedd14b18695d031f695d27dfbd94df5614495bb (diff) | |
download | ninja-648ee61ae84216d0236e0dbc211addc13b2cfa3a.tar.gz |
Expand tabs
Diffstat (limited to 'js/panels/color/colorpanelbase.reel/colorpanelbase.js')
-rwxr-xr-x | js/panels/color/colorpanelbase.reel/colorpanelbase.js | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/js/panels/color/colorpanelbase.reel/colorpanelbase.js b/js/panels/color/colorpanelbase.reel/colorpanelbase.js index 0223b9d8..a3525d0f 100755 --- a/js/panels/color/colorpanelbase.reel/colorpanelbase.js +++ b/js/panels/color/colorpanelbase.reel/colorpanelbase.js | |||
@@ -30,12 +30,12 @@ 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 | Popup = require("js/components/popup.reel").Popup, | 35 | Popup = require("js/components/popup.reel").Popup, |
36 | Slider = require("js/components/slider.reel").Slider, | 36 | Slider = require("js/components/slider.reel").Slider, |
37 | HotText = require("js/components/hottext.reel").HotText, | 37 | HotText = require("js/components/hottext.reel").HotText, |
38 | ColorBar = require("js/components/colorbar.reel").ColorBar; | 38 | ColorBar = require("js/components/colorbar.reel").ColorBar; |
39 | //////////////////////////////////////////////////////////////////////// | 39 | //////////////////////////////////////////////////////////////////////// |
40 | //Exporting as ColorPanelBase | 40 | //Exporting as ColorPanelBase |
41 | exports.ColorPanelBase = Montage.create(Component, { | 41 | exports.ColorPanelBase = Montage.create(Component, { |
@@ -47,7 +47,7 @@ exports.ColorPanelBase = Montage.create(Component, { | |||
47 | //////////////////////////////////////////////////////////////////// | 47 | //////////////////////////////////////////////////////////////////// |
48 | //Storing ColorPanel sliders mode | 48 | //Storing ColorPanel sliders mode |
49 | _panelMode: { | 49 | _panelMode: { |
50 | value: 'rgb' | 50 | value: 'rgb' |
51 | }, | 51 | }, |
52 | //////////////////////////////////////////////////////////////////// | 52 | //////////////////////////////////////////////////////////////////// |
53 | //Storing ColorPanel sliders mode | 53 | //Storing ColorPanel sliders mode |
@@ -505,11 +505,11 @@ exports.ColorPanelBase = Montage.create(Component, { | |||
505 | if (c && c.css) { | 505 | if (c && c.css) { |
506 | this.ctx.clearRect(0, 0, this.cvs.width, this.cvs.height); | 506 | this.ctx.clearRect(0, 0, this.cvs.width, this.cvs.height); |
507 | if (m === 'gradient') { | 507 | if (m === 'gradient') { |
508 | this.style.backgroundImage = c.css; | 508 | this.style.backgroundImage = c.css; |
509 | this.style.backgroundColor = 'transparent'; | 509 | this.style.backgroundColor = 'transparent'; |
510 | } else { | 510 | } else { |
511 | this.style.backgroundColor = c.css; | 511 | this.style.backgroundColor = c.css; |
512 | this.style.backgroundImage = 'none'; | 512 | this.style.backgroundImage = 'none'; |
513 | } | 513 | } |
514 | } else { | 514 | } else { |
515 | this.drawNoColor(this, this.cvs); | 515 | this.drawNoColor(this, this.cvs); |
@@ -839,7 +839,7 @@ exports.ColorPanelBase = Montage.create(Component, { | |||
839 | this.application.ninja.colorController.colorPopupManager.hideColorPopup(); | 839 | this.application.ninja.colorController.colorPopupManager.hideColorPopup(); |
840 | // | 840 | // |
841 | var stroke = this.colorManager.colorHistory.fill[this.colorManager.colorHistory.fill.length - 1], | 841 | var stroke = this.colorManager.colorHistory.fill[this.colorManager.colorHistory.fill.length - 1], |
842 | fill = this.colorManager.colorHistory.stroke[this.colorManager.colorHistory.stroke.length - 1]; | 842 | fill = this.colorManager.colorHistory.stroke[this.colorManager.colorHistory.stroke.length - 1]; |
843 | stroke.c.wasSetByCode = fill.c.wasSetByCode = false; | 843 | stroke.c.wasSetByCode = fill.c.wasSetByCode = false; |
844 | stroke.c.type = fill.c.type = 'change'; | 844 | stroke.c.type = fill.c.type = 'change'; |
845 | //////////////////////////////////////////////////////////// | 845 | //////////////////////////////////////////////////////////// |
@@ -924,18 +924,18 @@ exports.ColorPanelBase = Montage.create(Component, { | |||
924 | var mode, max1, max2, max3, color, fColor, sColor; | 924 | var mode, max1, max2, max3, color, fColor, sColor; |
925 | if (this.panelMode === 'hsl') { | 925 | if (this.panelMode === 'hsl') { |
926 | mode = 'hsl', | 926 | mode = 'hsl', |
927 | max1 = 360, | 927 | max1 = 360, |
928 | max2 = 100, | 928 | max2 = 100, |
929 | max3 = 100, | 929 | max3 = 100, |
930 | fColor = { h: 0, s: 0, l: 100 }, | 930 | fColor = { h: 0, s: 0, l: 100 }, |
931 | sColor = { h: 0, s: 0, l: 0 }; | 931 | sColor = { h: 0, s: 0, l: 0 }; |
932 | } else { | 932 | } else { |
933 | mode = 'rgb', | 933 | mode = 'rgb', |
934 | max1 = 255, | 934 | max1 = 255, |
935 | max2 = 255, | 935 | max2 = 255, |
936 | max3 = 255, | 936 | max3 = 255, |
937 | sColor = { r: 0, g: 0, b: 0 }, | 937 | sColor = { r: 0, g: 0, b: 0 }, |
938 | fColor = { r: 255, g: 255, b: 255 }; | 938 | fColor = { r: 255, g: 255, b: 255 }; |
939 | } | 939 | } |
940 | // | 940 | // |
941 | sColor.wasSetByCode = false; | 941 | sColor.wasSetByCode = false; |
@@ -1009,19 +1009,19 @@ exports.ColorPanelBase = Montage.create(Component, { | |||
1009 | var update, type; | 1009 | var update, type; |
1010 | // | 1010 | // |
1011 | if (!e._event.wasSetByCode) { | 1011 | if (!e._event.wasSetByCode) { |
1012 | // | 1012 | // |
1013 | if (!e.target.cInputType) { | 1013 | if (!e.target.cInputType) { |
1014 | type = 'hottext'; | 1014 | type = 'hottext'; |
1015 | } else { | 1015 | } else { |
1016 | type = 'slider' | 1016 | type = 'slider' |
1017 | } | 1017 | } |
1018 | // | 1018 | // |
1019 | if (e.target.changesColor) { | 1019 | if (e.target.changesColor) { |
1020 | // | 1020 | // |
1021 | if (this.panelMode === 'rgb') { | 1021 | if (this.panelMode === 'rgb') { |
1022 | // | 1022 | // |
1023 | if (this.colorManager.rgb && Math.round(this._combo[0][type].value) === this.colorManager.rgb.r && Math.round(this._combo[1][type].value) === this.colorManager.rgb.g && Math.round(this._combo[2][type].value) === this.colorManager.rgb.b) { | 1023 | if (this.colorManager.rgb && Math.round(this._combo[0][type].value) === this.colorManager.rgb.r && Math.round(this._combo[1][type].value) === this.colorManager.rgb.g && Math.round(this._combo[2][type].value) === this.colorManager.rgb.b) { |
1024 | return; | 1024 | return; |
1025 | } | 1025 | } |
1026 | // | 1026 | // |
1027 | update = { r: Math.round(this._combo[0][type].value), g: Math.round(this._combo[1][type].value), b: Math.round(this._combo[2][type].value) }; | 1027 | update = { r: Math.round(this._combo[0][type].value), g: Math.round(this._combo[1][type].value), b: Math.round(this._combo[2][type].value) }; |
@@ -1032,7 +1032,7 @@ exports.ColorPanelBase = Montage.create(Component, { | |||
1032 | } else if (this.panelMode === 'hsl') { | 1032 | } else if (this.panelMode === 'hsl') { |
1033 | // | 1033 | // |
1034 | if (this.colorManager.hsl && Math.round(this._combo[0][type].value) === this.colorManager.hsl.h && Math.round(this._combo[1][type].value) === this.colorManager.hsl.s && Math.round(this._combo[2][type].value) === this.colorManager.hsl.l) { | 1034 | if (this.colorManager.hsl && Math.round(this._combo[0][type].value) === this.colorManager.hsl.h && Math.round(this._combo[1][type].value) === this.colorManager.hsl.s && Math.round(this._combo[2][type].value) === this.colorManager.hsl.l) { |
1035 | return; | 1035 | return; |
1036 | } | 1036 | } |
1037 | // | 1037 | // |
1038 | update = { h: Math.round(this._combo[0][type].value), s: Math.round(this._combo[1][type].value), l: Math.round(this._combo[2][type].value) }; | 1038 | update = { h: Math.round(this._combo[0][type].value), s: Math.round(this._combo[1][type].value), l: Math.round(this._combo[2][type].value) }; |
@@ -1042,9 +1042,9 @@ exports.ColorPanelBase = Montage.create(Component, { | |||
1042 | this.colorManager.hsl = update; | 1042 | this.colorManager.hsl = update; |
1043 | } | 1043 | } |
1044 | } else { | 1044 | } else { |
1045 | // | 1045 | // |
1046 | update = { value: this._combo[3][type].value/100, wasSetByCode: false, type: 'change' }; | 1046 | update = { value: this._combo[3][type].value/100, wasSetByCode: false, type: 'change' }; |
1047 | // | 1047 | // |
1048 | this.colorManager.alpha = update; | 1048 | this.colorManager.alpha = update; |
1049 | } | 1049 | } |
1050 | } | 1050 | } |
@@ -1432,10 +1432,10 @@ exports.ColorPanelBase = Montage.create(Component, { | |||
1432 | // | 1432 | // |
1433 | selectInputType: { | 1433 | selectInputType: { |
1434 | value: function (type) { | 1434 | value: function (type) { |
1435 | if (this.colorManager.input === 'chip') { | 1435 | if (this.colorManager.input === 'chip') { |
1436 | this.application.ninja.colorController.colorPopupManager.hideColorPopup(); | 1436 | this.application.ninja.colorController.colorPopupManager.hideColorPopup(); |
1437 | return; | 1437 | return; |
1438 | } | 1438 | } |
1439 | //Checking for the type to be formatted as expected, otherwise we unselected all buttons | 1439 | //Checking for the type to be formatted as expected, otherwise we unselected all buttons |
1440 | try { | 1440 | try { |
1441 | type._event.srcElement.inputType; | 1441 | type._event.srcElement.inputType; |
@@ -1479,7 +1479,7 @@ exports.ColorPanelBase = Montage.create(Component, { | |||
1479 | this.application.ninja.colorController.colorPopupManager.showColorPopup((type._event.clientX - type._event.offsetX) + 'px', (type._event.target.clientHeight / 2 + type._event.clientY - type._event.offsetY) + 'px', 'right', 'top'); | 1479 | this.application.ninja.colorController.colorPopupManager.showColorPopup((type._event.clientX - type._event.offsetX) + 'px', (type._event.target.clientHeight / 2 + type._event.clientY - type._event.offsetY) + 'px', 'right', 'top'); |
1480 | //} else { | 1480 | //} else { |
1481 | // | 1481 | // |
1482 | // this.application.ninja.colorController.colorPopupManager.showColorPopup((type._event.clientX - type._event.offsetX)+parseInt(type._event.target.offsetWidth)+'px', (type._event.target.offsetHeight/2+type._event.clientY - type._event.offsetY)+'px', 'left', 'top'); | 1482 | // this.application.ninja.colorController.colorPopupManager.showColorPopup((type._event.clientX - type._event.offsetX)+parseInt(type._event.target.offsetWidth)+'px', (type._event.target.offsetHeight/2+type._event.clientY - type._event.offsetY)+'px', 'left', 'top'); |
1483 | //} | 1483 | //} |
1484 | } | 1484 | } |
1485 | } | 1485 | } |
@@ -1580,7 +1580,7 @@ exports.ColorPanelBase = Montage.create(Component, { | |||
1580 | ctx.lineTo(2, 1); | 1580 | ctx.lineTo(2, 1); |
1581 | ctx.stroke(); | 1581 | ctx.stroke(); |
1582 | } else { | 1582 | } else { |
1583 | //Adding class to buttons with no canvas | 1583 | //Adding class to buttons with no canvas |
1584 | selected[i].className = selected[i].className + ' selected'; | 1584 | selected[i].className = selected[i].className + ' selected'; |
1585 | } | 1585 | } |
1586 | } | 1586 | } |