MCPcopy Create free account
hub / github.com/microsoft/SandDance / gridLayoutGroups

Function gridLayoutGroups

docs/app/js/sanddance-app.js:120358–120400  ·  view source on GitHub ↗
(group)

Source from the content-addressed store, hash-verified

120356const min = (a, b)=>Math.floor(Math.min(a, b));
120357const max = (a, b)=>Math.ceil(Math.max(a, b));
120358function gridLayoutGroups(group) {
120359 var groups = group.items, n = groups.length, i = 0, mark, items;
120360 const views = {
120361 marks: [],
120362 rowheaders: [],
120363 rowfooters: [],
120364 colheaders: [],
120365 colfooters: [],
120366 rowtitle: null,
120367 coltitle: null
120368 }; // layout axes, gather legends, collect bounds
120369 for(; i < n; ++i){
120370 mark = groups[i];
120371 items = mark.items;
120372 if (mark.marktype === Group) switch(mark.role){
120373 case AxisRole:
120374 case LegendRole:
120375 case TitleRole:
120376 break;
120377 case RowHeader:
120378 views.rowheaders.push(...items);
120379 break;
120380 case RowFooter:
120381 views.rowfooters.push(...items);
120382 break;
120383 case ColHeader:
120384 views.colheaders.push(...items);
120385 break;
120386 case ColFooter:
120387 views.colfooters.push(...items);
120388 break;
120389 case RowTitle:
120390 views.rowtitle = items[0];
120391 break;
120392 case ColTitle:
120393 views.coltitle = items[0];
120394 break;
120395 default:
120396 views.marks.push(...items);
120397 }
120398 }
120399 return views;
120400}
120401function bboxFlush(item) {
120402 return new (0, _vegaScenegraph.Bounds)().set(0, 0, item.width || 0, item.height || 0);
120403}

Callers 1

trellisLayoutFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected