21 using NodeDecorator::NodeDecorator;
23 void ComputeRequirement()
override {
24 NodeDecorator::ComputeRequirement();
25 requirement_ = children_[0]->requirement();
29 void SetBox(
Box box)
override {
30 NodeDecorator::SetBox(box);
31 if (box_.x_min > box_.x_max) {
34 children_[0]->SetBox(box);
38 NodeDecorator::Render(screen);
42 int size_inner = box_.
y_max - box_.y_min;
43 int size_outter = stencil.
y_max - stencil.
y_min + 1;
44 if (size_outter >= size_inner) {
48 int size = 2 * size_outter * size_outter / size_inner;
51 int start_y = 2 * stencil.
y_min +
52 2 * (stencil.
y_min - box_.y_min) * size_outter / size_inner;
54 const int x = stencil.
x_max;
55 for (
int y = stencil.
y_min; y <= stencil.
y_max; ++y) {
57 int y_down = 2 * y + 1;
58 bool up = (start_y <= y_up) && (y_up <= start_y +
size);
59 bool down = (start_y <= y_down) && (y_down <= start_y +
size);
61 const char* c = up ? (down ?
"┃" :
"╹") : (down ?
"╻" :
" ");
67 return std::make_shared<Impl>(std::move(child));