(view, legend)
| 104306 | } |
| 104307 | |
| 104308 | function legendLayout(view, legend) { |
| 104309 | var item = legend.items[0], |
| 104310 | datum = item.datum, |
| 104311 | orient = item.orient, |
| 104312 | bounds = item.bounds, |
| 104313 | x = item.x, |
| 104314 | y = item.y, |
| 104315 | w, |
| 104316 | h; // cache current bounds for later comparison |
| 104317 | |
| 104318 | item._bounds ? item._bounds.clear().union(bounds) : item._bounds = bounds.clone(); |
| 104319 | bounds.clear(); // adjust legend to accommodate padding and title |
| 104320 | |
| 104321 | legendGroupLayout(view, item, item.items[0].items[0]); // aggregate bounds to determine size, and include origin |
| 104322 | |
| 104323 | bounds = legendBounds(item, bounds); |
| 104324 | w = 2 * item.padding; |
| 104325 | h = 2 * item.padding; |
| 104326 | |
| 104327 | if (!bounds.empty()) { |
| 104328 | w = Math.ceil(bounds.width() + w); |
| 104329 | h = Math.ceil(bounds.height() + h); |
| 104330 | } |
| 104331 | |
| 104332 | if (datum.type === _constants.Symbols) { |
| 104333 | legendEntryLayout(item.items[0].items[0].items[0].items); |
| 104334 | } |
| 104335 | |
| 104336 | if (orient !== _constants.None) { |
| 104337 | item.x = x = 0; |
| 104338 | item.y = y = 0; |
| 104339 | } |
| 104340 | |
| 104341 | item.width = w; |
| 104342 | item.height = h; |
| 104343 | (0, _vegaScenegraph.boundStroke)(bounds.set(x, y, x + w, y + h), item); |
| 104344 | item.mark.bounds.clear().union(bounds); |
| 104345 | return item; |
| 104346 | } |
| 104347 | |
| 104348 | function legendBounds(item, b) { |
| 104349 | // aggregate item bounds |
nothing calls this directly
no test coverage detected