MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / PiuColumnFitVertically

Function PiuColumnFitVertically

modules/piu/All/piuColumn.c:56–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54};
55
56void PiuColumnFitVertically(void* it)
57{
58 PiuColumn* self = it;
59 int32_t portion = (*self)->portion, sum = (*self)->sum;
60 PiuCoordinate y = 0;
61 PiuRectangle bounds;
62 PiuCoordinates coordinates;
63 PiuContent* content = (*self)->first;
64 PiuContentFitVertically(it);
65 if (portion) {
66 int32_t slop = (*self)->bounds.height - sum;
67 int32_t step = slop / portion;
68 while (content) {
69 coordinates = &((*content)->coordinates);
70 if ((coordinates->vertical & piuTopBottom) == piuTopBottom) {
71 portion--;
72 if (portion) {
73 (*content)->bounds.height = step + coordinates->height;
74 slop -= step;
75 }
76 else
77 (*content)->bounds.height = slop + coordinates->height;
78 }
79 else
80 (*content)->bounds.height = coordinates->height;
81 (*(*content)->dispatch->fitVertically)(content);
82 bounds = &((*content)->bounds);
83 coordinates = &((*content)->coordinates);
84 y += coordinates->top;
85 bounds->y = y;
86 y += bounds->height + coordinates->bottom;
87 (*content)->flags &= ~piuYChanged;
88 (*content)->flags |= piuPlaced;
89 content = (*content)->next;
90 }
91 }
92 else {
93 while (content) {
94 (*content)->bounds.height = (*content)->coordinates.height;
95 (*(*content)->dispatch->fitVertically)(content);
96 bounds = &((*content)->bounds);
97 coordinates = &((*content)->coordinates);
98 y += coordinates->top;
99 bounds->y = y;
100 y += bounds->height + coordinates->bottom;
101 (*content)->flags &= ~piuYChanged;
102 (*content)->flags |= piuPlaced;
103 content = (*content)->next;
104 }
105 }
106 (*self)->flags |= piuContentsPlaced;
107}
108
109void PiuColumnMeasureVertically(void* it)
110{

Callers

nothing calls this directly

Calls 1

PiuContentFitVerticallyFunction · 0.85

Tested by

no test coverage detected