(boxes, chartArea, params, stacks)
| 177 | } |
| 178 | |
| 179 | function fitBoxes(boxes, chartArea, params, stacks) { |
| 180 | const refitBoxes = []; |
| 181 | let i, ilen, layout, box, refit, changed; |
| 182 | |
| 183 | for (i = 0, ilen = boxes.length, refit = 0; i < ilen; ++i) { |
| 184 | layout = boxes[i]; |
| 185 | box = layout.box; |
| 186 | |
| 187 | box.update( |
| 188 | layout.width || chartArea.w, |
| 189 | layout.height || chartArea.h, |
| 190 | getMargins(layout.horizontal, chartArea) |
| 191 | ); |
| 192 | const {same, other} = updateDims(chartArea, params, layout, stacks); |
| 193 | |
| 194 | class="cm">// Dimensions changed and there were non full width boxes before this |
| 195 | class="cm">// -> we have to refit those |
| 196 | refit |= same && refitBoxes.length; |
| 197 | |
| 198 | class="cm">// Chart area changed in the opposite direction |
| 199 | changed = changed || other; |
| 200 | |
| 201 | if (!box.fullSize) { class="cm">// fullSize boxes don't need to be re-fitted in any case |
| 202 | refitBoxes.push(layout); |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | return refit && fitBoxes(refitBoxes, chartArea, params, stacks) || changed; |
| 207 | } |
| 208 | |
| 209 | function setBoxDims(box, left, top, width, height) { |
| 210 | box.top = top; |
no test coverage detected