diff options
Diffstat (limited to 'js/controllers/elements/element-controller.js')
-rwxr-xr-x | js/controllers/elements/element-controller.js | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index ec0335b4..9f00604f 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js | |||
@@ -74,8 +74,9 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, | |||
74 | 74 | ||
75 | //-------------------------------------------------------------------------------------------------------- | 75 | //-------------------------------------------------------------------------------------------------------- |
76 | // Routines to get/set color properties | 76 | // Routines to get/set color properties |
77 | // borderSide : "top", "right", "bottom", or "left" | ||
77 | getColor: { | 78 | getColor: { |
78 | value: function(el, isFill) { | 79 | value: function(el, isFill, borderSide) { |
79 | var colorObj, | 80 | var colorObj, |
80 | color, | 81 | color, |
81 | image; | 82 | image; |
@@ -87,22 +88,29 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, | |||
87 | { | 88 | { |
88 | return el.elementModel.fill; | 89 | return el.elementModel.fill; |
89 | } | 90 | } |
90 | // return this.application.ninja.stylesController.getElementStyle(el, "background-color"); | ||
91 | //TODO: Once logic for color and gradient is established, this needs to be revised | 91 | //TODO: Once logic for color and gradient is established, this needs to be revised |
92 | color = this.getProperty(el, "background-color"); | 92 | color = this.getProperty(el, "background-color"); |
93 | image = this.getProperty(el, "background-image"); | 93 | image = this.getProperty(el, "background-image"); |
94 | } | 94 | } |
95 | else | 95 | else |
96 | { | 96 | { |
97 | // TODO - Need to figure out which border side user wants | 97 | // Try getting border color from specific side first |
98 | if(el.elementModel.stroke) | 98 | if(borderSide) |
99 | { | 99 | { |
100 | return el.elementModel.stroke; | 100 | color = this.getProperty(el, "border-" + borderSide + "-color"); |
101 | image = this.getProperty(el, "border-" + borderSide + "-image"); | ||
102 | } | ||
103 | |||
104 | // If no color was found, look up the shared border color | ||
105 | if(!color && !image) | ||
106 | { | ||
107 | if(el.elementModel.stroke) | ||
108 | { | ||
109 | return el.elementModel.stroke; | ||
110 | } | ||
111 | color = this.getProperty(el, "border-color"); | ||
112 | image = this.getProperty(el, "border-image"); | ||
101 | } | 113 | } |
102 | // TODO - Need to figure out which border side user wants | ||
103 | // return this.application.ninja.stylesController.getElementStyle(el, "border-color"); | ||
104 | color = this.getProperty(el, "border-color"); | ||
105 | image = this.getProperty(el, "border-image"); | ||
106 | } | 114 | } |
107 | 115 | ||
108 | if(color || image) { | 116 | if(color || image) { |
@@ -120,11 +128,15 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, | |||
120 | { | 128 | { |
121 | el.elementModel.fill = colorObj; | 129 | el.elementModel.fill = colorObj; |
122 | } | 130 | } |
123 | else | 131 | else if(!borderSide) |
124 | { | 132 | { |
125 | // TODO - Need to update border style and width also | 133 | // TODO - Need to update border style and width also |
126 | el.elementModel.stroke = colorObj; | 134 | el.elementModel.stroke = colorObj; |
127 | } | 135 | } |
136 | else | ||
137 | { | ||
138 | // TODO - Should update specific border sides too | ||
139 | } | ||
128 | 140 | ||
129 | return colorObj; | 141 | return colorObj; |
130 | } | 142 | } |