diff options
Diffstat (limited to 'js/panels/color/colorpanelpopup.reel/colorpanelpopup.js')
-rwxr-xr-x | js/panels/color/colorpanelpopup.reel/colorpanelpopup.js | 716 |
1 files changed, 358 insertions, 358 deletions
diff --git a/js/panels/color/colorpanelpopup.reel/colorpanelpopup.js b/js/panels/color/colorpanelpopup.reel/colorpanelpopup.js index 83d4e6ed..6511cddc 100755 --- a/js/panels/color/colorpanelpopup.reel/colorpanelpopup.js +++ b/js/panels/color/colorpanelpopup.reel/colorpanelpopup.js | |||
@@ -30,18 +30,18 @@ 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 | Slider = require("js/components/slider.reel").Slider, | 35 | Slider = require("js/components/slider.reel").Slider, |
36 | HotText = require("js/components/hottext.reel").HotText, | 36 | HotText = require("js/components/hottext.reel").HotText, |
37 | ColorWheel = require("js/components/colorwheel.reel").ColorWheel, | 37 | ColorWheel = require("js/components/colorwheel.reel").ColorWheel, |
38 | GradientPicker = require("js/components/gradientpicker.reel").GradientPicker; | 38 | GradientPicker = require("js/components/gradientpicker.reel").GradientPicker; |
39 | //////////////////////////////////////////////////////////////////////// | 39 | //////////////////////////////////////////////////////////////////////// |
40 | //Exporting as ColorPanelPopup | 40 | //Exporting as ColorPanelPopup |
41 | exports.ColorPanelPopup = Montage.create(Component, { | 41 | exports.ColorPanelPopup = Montage.create(Component, { |
42 | //////////////////////////////////////////////////////////////////// | 42 | //////////////////////////////////////////////////////////////////// |
43 | // | 43 | // |
44 | hasTemplate: { | 44 | hasTemplate: { |
45 | value: true | 45 | value: true |
46 | }, | 46 | }, |
47 | //////////////////////////////////////////////////////////////////// | 47 | //////////////////////////////////////////////////////////////////// |
@@ -58,424 +58,424 @@ exports.ColorPanelPopup = Montage.create(Component, { | |||
58 | //////////////////////////////////////////////////////////////////// | 58 | //////////////////////////////////////////////////////////////////// |
59 | // | 59 | // |
60 | _components: { | 60 | _components: { |
61 | value: null | 61 | value: null |
62 | }, | 62 | }, |
63 | //////////////////////////////////////////////////////////////////// | 63 | //////////////////////////////////////////////////////////////////// |
64 | // | 64 | // |
65 | setNoColor: { | 65 | setNoColor: { |
66 | value: function (code) { | 66 | value: function (code) { |
67 | if (this.colorManager) this.colorManager.applyNoColor(code); | 67 | if (this.colorManager) this.colorManager.applyNoColor(code); |
68 | // | 68 | // |
69 | if (!code && !this.props.panel) { | 69 | if (!code && !this.props.panel) { |
70 | this.dispatchEvent({type: 'change', wasSetByCode: code, mode: 'nocolor', value: null}); | 70 | this.dispatchEvent({type: 'change', wasSetByCode: code, mode: 'nocolor', value: null}); |
71 | } | 71 | } |
72 | } | 72 | } |
73 | }, | 73 | }, |
74 | //////////////////////////////////////////////////////////////////// | 74 | //////////////////////////////////////////////////////////////////// |
75 | // | 75 | // |
76 | prepareForDraw: { | 76 | prepareForDraw: { |
77 | value: function () { | 77 | value: function () { |
78 | // | 78 | // |
79 | this._components = null; | 79 | this._components = null; |
80 | this._components = {wheel: null, combo: null, gradient: null, hex: null}; | 80 | this._components = {wheel: null, combo: null, gradient: null, hex: null}; |
81 | } | 81 | } |
82 | }, | 82 | }, |
83 | //////////////////////////////////////////////////////////////////// | 83 | //////////////////////////////////////////////////////////////////// |
84 | // | 84 | // |
85 | willDraw: { | 85 | willDraw: { |
86 | value: function() { | 86 | value: function() { |
87 | // | 87 | // |
88 | this.element.style.opacity = 0; | 88 | this.element.style.opacity = 0; |
89 | // | 89 | // |
90 | this._components.combo = {}; | 90 | this._components.combo = {}; |
91 | this._components.combo.slider = Slider.create(); | 91 | this._components.combo.slider = Slider.create(); |
92 | this._components.combo.hottext = HotText.create(); | 92 | this._components.combo.hottext = HotText.create(); |
93 | this._components.combo.slider.element = this.alphaSlider; | 93 | this._components.combo.slider.element = this.alphaSlider; |
94 | this._components.combo.hottext.element = this.alphaHottext; | 94 | this._components.combo.hottext.element = this.alphaHottext; |
95 | // | 95 | // |
96 | Object.defineBinding(this._components.combo.hottext, "value", { | 96 | Object.defineBinding(this._components.combo.hottext, "value", { |
97 | boundObject: this._components.combo.slider, | 97 | boundObject: this._components.combo.slider, |
98 | boundObjectPropertyPath: "value", | 98 | boundObjectPropertyPath: "value", |
99 | oneway: false, | 99 | oneway: false, |
100 | boundValueMutator: function(value) { | 100 | boundValueMutator: function(value) { |
101 | return Math.round(value); | 101 | return Math.round(value); |
102 | } | 102 | } |
103 | }); | 103 | }); |
104 | // | 104 | // |
105 | if (this.application.ninja.colorController.colorView && this.props.panel) { | 105 | if (this.application.ninja.colorController.colorView && this.props.panel) { |
106 | Object.defineBinding(this._components.combo.slider, "value", { | 106 | Object.defineBinding(this._components.combo.slider, "value", { |
107 | boundObject: this.application.ninja.colorController.colorView._combo[3].slider, | 107 | boundObject: this.application.ninja.colorController.colorView._combo[3].slider, |
108 | boundObjectPropertyPath: "value", | 108 | boundObjectPropertyPath: "value", |
109 | oneway: false, | 109 | oneway: false, |
110 | boundValueMutator: function(value) { | 110 | boundValueMutator: function(value) { |
111 | return Math.round(value); | 111 | return Math.round(value); |
112 | } | 112 | } |
113 | }); | 113 | }); |
114 | } | 114 | } |
115 | // | 115 | // |
116 | this._components.combo.slider.maxValue = this._components.combo.hottext.maxValue = 100; | 116 | this._components.combo.slider.maxValue = this._components.combo.hottext.maxValue = 100; |
117 | // | 117 | // |
118 | if (this.application.ninja.colorController.colorView) { | 118 | if (this.application.ninja.colorController.colorView) { |
119 | this._components.combo.slider.customBackground = this.application.ninja.colorController.colorView._slider3Background.bind(this.application.ninja.colorController.colorView); | 119 | this._components.combo.slider.customBackground = this.application.ninja.colorController.colorView._slider3Background.bind(this.application.ninja.colorController.colorView); |
120 | } | 120 | } |
121 | // | 121 | // |
122 | this._components.combo.slider.addEventListener('change', this.alphaChange.bind(this), true); | 122 | this._components.combo.slider.addEventListener('change', this.alphaChange.bind(this), true); |
123 | this._components.combo.hottext.addEventListener('change', this.alphaChange.bind(this), true); | 123 | this._components.combo.hottext.addEventListener('change', this.alphaChange.bind(this), true); |
124 | // | 124 | // |
125 | this._components.wheel = ColorWheel.create(); | 125 | this._components.wheel = ColorWheel.create(); |
126 | this._components.wheel.element = this.wheel; | 126 | this._components.wheel.element = this.wheel; |
127 | this._components.wheel.element.style.display = 'block'; | 127 | this._components.wheel.element.style.display = 'block'; |
128 | this._components.wheel.rimWidth = 14; | 128 | this._components.wheel.rimWidth = 14; |
129 | this._components.wheel.strokeWidth = 2; | 129 | this._components.wheel.strokeWidth = 2; |
130 | // | 130 | // |
131 | this._components.wheel.value = this.colorManager.hsv; | 131 | this._components.wheel.value = this.colorManager.hsv; |
132 | this._components.wheel.addEventListener('change', this, true); | 132 | this._components.wheel.addEventListener('change', this, true); |
133 | this._components.wheel.addEventListener('changing', this, true); | 133 | this._components.wheel.addEventListener('changing', this, true); |
134 | // | 134 | // |
135 | Object.defineBinding(this._components.wheel, "value", { | 135 | Object.defineBinding(this._components.wheel, "value", { |
136 | boundObject: this.colorManager, | 136 | boundObject: this.colorManager, |
137 | boundObjectPropertyPath: "_hsv", | 137 | boundObjectPropertyPath: "_hsv", |
138 | boundValueMutator: function(value) { | 138 | boundValueMutator: function(value) { |
139 | return value; | 139 | return value; |
140 | } | 140 | } |
141 | }); | 141 | }); |
142 | } | 142 | } |
143 | }, | 143 | }, |
144 | //////////////////////////////////////////////////////////////////// | 144 | //////////////////////////////////////////////////////////////////// |
145 | // | 145 | // |
146 | draw: { | 146 | draw: { |
147 | value: function() { | 147 | value: function() { |
148 | // | 148 | // |
149 | if (!this.props || (this.props && this.props.palette)) { | 149 | if (!this.props || (this.props && this.props.palette)) { |
150 | // | 150 | // |
151 | this.btnPalette.addEventListener('click', function () { | 151 | this.btnPalette.addEventListener('click', function () { |
152 | this.popupSwitchInputTo(this.palettes); | 152 | this.popupSwitchInputTo(this.palettes); |
153 | }.bind(this), true); | 153 | }.bind(this), true); |
154 | // | 154 | // |
155 | this.drawPalette(this.defaultPalette, this.colorManager); | 155 | this.drawPalette(this.defaultPalette, this.colorManager); |
156 | } else { | 156 | } else { |
157 | this.btnPalette.style.display = 'none'; | 157 | this.btnPalette.style.display = 'none'; |
158 | } | 158 | } |
159 | // | 159 | // |
160 | if (!this.props || (this.props && this.props.gradient)) { | 160 | if (!this.props || (this.props && this.props.gradient)) { |