aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/color-controller.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-06-16 19:04:13 -0700
committerJose Antonio Marquez2012-06-16 19:04:13 -0700
commitd5aec31ee519069ff6120e5d5685828750501e67 (patch)
treecaaa10c37c7bcb20fc1f6e0130da9f892da6af9e /js/controllers/color-controller.js
parent60bc2ff4b617ec6bbb3506770401f0adef60671d (diff)
downloadninja-d5aec31ee519069ff6120e5d5685828750501e67.tar.gz
More cleaning up
Controller will need a review and refactoring.
Diffstat (limited to 'js/controllers/color-controller.js')
-rwxr-xr-xjs/controllers/color-controller.js48
1 files changed, 8 insertions, 40 deletions
diff --git a/js/controllers/color-controller.js b/js/controllers/color-controller.js
index 3edaff86..3165988d 100755
--- a/js/controllers/color-controller.js
+++ b/js/controllers/color-controller.js
@@ -19,13 +19,11 @@ exports.ColorController = Montage.create(Component, {
19 //////////////////////////////////////////////////////////////////// 19 ////////////////////////////////////////////////////////////////////
20 // 20 //
21 hasTemplate: { 21 hasTemplate: {
22 enumerable: true,
23 value: false 22 value: false
24 }, 23 },
25 //////////////////////////////////////////////////////////////////// 24 ////////////////////////////////////////////////////////////////////
26 // 25 //
27 deserializedFromTemplate: { 26 deserializedFromTemplate: {
28 enumerable: true,
29 value: function () { 27 value: function () {
30 //Setting up colorManager in other classes 28 //Setting up colorManager in other classes
31 this.colorPanelBase.colorManager = this.colorModel; 29 this.colorPanelBase.colorManager = this.colorModel;
@@ -38,60 +36,47 @@ exports.ColorController = Montage.create(Component, {
38 //////////////////////////////////////////////////////////////////// 36 ////////////////////////////////////////////////////////////////////
39 // 37 //
40 colorModel: { 38 colorModel: {
41 enumerable: true,
42 value: ColorModel 39 value: ColorModel
43 }, 40 },
44 //////////////////////////////////////////////////////////////////// 41 ////////////////////////////////////////////////////////////////////
45 // 42 //
46 colorPanelBase: { 43 colorPanelBase: {
47 enumerable: true,
48 value: ColorPanelBase 44 value: ColorPanelBase
49 }, 45 },
50 //////////////////////////////////////////////////////////////////// 46 ////////////////////////////////////////////////////////////////////
51 // 47 //
52 colorPopupManager: { 48 colorPopupManager: {
53 enumerable: true,
54 value: ColorPopupManager 49 value: ColorPopupManager
55 }, 50 },
56 //////////////////////////////////////////////////////////////////// 51 ////////////////////////////////////////////////////////////////////
57 // 52 //
58 colorButtonManager: { 53 colorButtonManager: {
59 enumerable: true,
60 value: ColorPopupManager 54 value: ColorPopupManager
61 }, 55 },
62 //////////////////////////////////////////////////////////////////// 56 ////////////////////////////////////////////////////////////////////
63 // 57 //
64 colorView: { 58 colorView: {
65 enumerable: true,
66 value: null 59 value: null
67 }, 60 },
68 //////////////////////////////////////////////////////////////////// 61 ////////////////////////////////////////////////////////////////////
69 // 62 //
70 colorToolbar: { 63 colorToolbar: {
71 enumerable: true,
72 value: null 64 value: null
73 }, 65 },
74 //////////////////////////////////////////////////////////////////// 66 ////////////////////////////////////////////////////////////////////
75 // 67 //
76 _popupTab: { 68 _popupTab: {
77 enumerable: false,
78 value: 'wheel' 69 value: 'wheel'
79 }, 70 },
80 //////////////////////////////////////////////////////////////////// 71 ////////////////////////////////////////////////////////////////////
81 // 72 //
82 popupTab: { 73 popupTab: {
83 enumerable: true, 74 get: function() {return this._popupTab;},
84 get: function() { 75 set: function(value) {this._popupTab = value.toLowerCase();}
85 return this._popupTab;
86 },
87 set: function(value) {
88 this._popupTab = value.toLowerCase();
89 }
90 }, 76 },
91 //////////////////////////////////////////////////////////////////// 77 ////////////////////////////////////////////////////////////////////
92 // 78 //
93 addButton: { 79 addButton: {
94 enumerable: true,
95 value: function (type, button) { 80 value: function (type, button) {
96 if (this.colorView) { 81 if (this.colorView) {
97 this.colorView.addButton(type, button); 82 this.colorView.addButton(type, button);
@@ -107,7 +92,6 @@ exports.ColorController = Montage.create(Component, {
107 //////////////////////////////////////////////////////////////////// 92 ////////////////////////////////////////////////////////////////////
108 // 93 //
109 removeButton: { 94 removeButton: {
110 enumerable: true,
111 value: function (type, button) { 95 value: function (type, button) {
112 if (this.colorView) { 96 if (this.colorView) {
113 this.colorView.removeButton(type, button); 97 this.colorView.removeButton(type, button);
@@ -123,41 +107,28 @@ exports.ColorController = Montage.create(Component, {
123 //////////////////////////////////////////////////////////////////// 107 ////////////////////////////////////////////////////////////////////
124 // 108 //
125 _fill: { 109 _fill: {
126 enumerable: false,
127 value: null 110 value: null
128 }, 111 },
129 //////////////////////////////////////////////////////////////////// 112 ////////////////////////////////////////////////////////////////////
130 // 113 //
131 fill: { 114 fill: {
132 enumerable: true, 115 get: function() {return this._fill;},
133 get: function() { 116 set: function(value) {this._fill = value;}
134 return this._fill;
135 },
136 set: function(value) {
137 this._fill = value;
138 }
139 }, 117 },
140 //////////////////////////////////////////////////////////////////// 118 ////////////////////////////////////////////////////////////////////
141 // 119 //
142 _stroke: { 120 _stroke: {
143 enumerable: false,
144 value: null 121 value: null
145 }, 122 },
146 //////////////////////////////////////////////////////////////////// 123 ////////////////////////////////////////////////////////////////////
147 // 124 //
148 stroke: { 125 stroke: {
149 enumerable: true, 126 get: function() {return this._stroke;},
150 get: function() { 127 set: function(value) {this._stroke = value;}
151 return this._stroke;
152 },
153 set: function(value) {
154 this._stroke = value;
155 }
156 }, 128 },
157 //////////////////////////////////////////////////////////////////// 129 ////////////////////////////////////////////////////////////////////
158 // 130 //
159 getBackground: { 131 getBackground: {
160 enumerable: true,
161 value: function (element) { 132 value: function (element) {
162 //TODO: Return object with all background properties 133 //TODO: Return object with all background properties
163 console.log(ElementsMediator.getProperty(element, 'background-color')); 134 console.log(ElementsMediator.getProperty(element, 'background-color'));
@@ -167,7 +138,6 @@ exports.ColorController = Montage.create(Component, {
167 //////////////////////////////////////////////////////////////////// 138 ////////////////////////////////////////////////////////////////////
168 // 139 //
169 getBorder: { 140 getBorder: {
170 enumerable: true,
171 value: function (element) { 141 value: function (element) {
172 142
173 } 143 }
@@ -175,7 +145,6 @@ exports.ColorController = Montage.create(Component, {
175 //////////////////////////////////////////////////////////////////// 145 ////////////////////////////////////////////////////////////////////
176 // 146 //
177 setColor: { 147 setColor: {
178 enumerable: true,
179 value: function (mode, color, isFill, selection) { 148 value: function (mode, color, isFill, selection) {
180 var elements; 149 var elements;
181 //The selection is optional, if none, it asks for the currently selected elements 150 //The selection is optional, if none, it asks for the currently selected elements
@@ -195,7 +164,6 @@ exports.ColorController = Montage.create(Component, {
195 //////////////////////////////////////////////////////////////////// 164 ////////////////////////////////////////////////////////////////////
196 // 165 //
197 handleChange: { 166 handleChange: {
198 enumerable: true,
199 value: function (e) { 167 value: function (e) {
200 // 168 //
201 var color, input = e._event.input, panelMode, mode = e._event.mode; 169 var color, input = e._event.input, panelMode, mode = e._event.mode;
@@ -244,7 +212,6 @@ exports.ColorController = Montage.create(Component, {
244 //////////////////////////////////////////////////////////////////// 212 ////////////////////////////////////////////////////////////////////
245 //Converts CSS to a color object to be used by the color model 213 //Converts CSS to a color object to be used by the color model
246 getColorObjFromCss: { 214 getColorObjFromCss: {
247 enumerable: true,
248 value: function (css) { 215 value: function (css) {
249 // 216 //
250 var color, arr, i, j, temp, c, gradient; 217 var color, arr, i, j, temp, c, gradient;
@@ -341,7 +308,6 @@ exports.ColorController = Montage.create(Component, {
341 //////////////////////////////////////////////////////////////////// 308 ////////////////////////////////////////////////////////////////////
342 //Parses simple solid CSS string into color object 309 //Parses simple solid CSS string into color object
343 parseCssToColor: { 310 parseCssToColor: {
344 enumerable: true,
345 value: function (css) { 311 value: function (css) {
346 var color, r, p; 312 var color, r, p;
347 //Parsing string and converting into color object 313 //Parsing string and converting into color object
@@ -368,4 +334,6 @@ exports.ColorController = Montage.create(Component, {
368 return color; 334 return color;
369 } 335 }
370 } 336 }