(view, legend)
| 120681 | return p; |
| 120682 | } |
| 120683 | function legendLayout(view, legend) { |
| 120684 | var item = legend.items[0], datum = item.datum, orient = item.orient, bounds = item.bounds, x = item.x, y = item.y, w, h; // cache current bounds for later comparison |
| 120685 | item._bounds ? item._bounds.clear().union(bounds) : item._bounds = bounds.clone(); |
| 120686 | bounds.clear(); // adjust legend to accommodate padding and title |
| 120687 | legendGroupLayout(view, item, item.items[0].items[0]); // aggregate bounds to determine size, and include origin |
| 120688 | bounds = legendBounds(item, bounds); |
| 120689 | w = 2 * item.padding; |
| 120690 | h = 2 * item.padding; |
| 120691 | if (!bounds.empty()) { |
| 120692 | w = Math.ceil(bounds.width() + w); |
| 120693 | h = Math.ceil(bounds.height() + h); |
| 120694 | } |
| 120695 | if (datum.type === Symbols) legendEntryLayout(item.items[0].items[0].items[0].items); |
| 120696 | if (orient !== None) { |
| 120697 | item.x = x = 0; |
| 120698 | item.y = y = 0; |
| 120699 | } |
| 120700 | item.width = w; |
| 120701 | item.height = h; |
| 120702 | (0, _vegaScenegraph.boundStroke)(bounds.set(x, y, x + w, y + h), item); |
| 120703 | item.mark.bounds.clear().union(bounds); |
| 120704 | return item; |
| 120705 | } |
| 120706 | function legendBounds(item, b) { |
| 120707 | // aggregate item bounds |
| 120708 | item.items.forEach((_)=>b.union(_.bounds)); // anchor to legend origin |
no test coverage detected