Add html_like example. Improve take_any_args.

This commit is contained in:
Arthur Sonzogni
2019-01-23 02:16:00 +01:00
parent ce7867ab03
commit 1e92db7ec0
5 changed files with 94 additions and 13 deletions

View File

@@ -8,9 +8,7 @@ Elements paragraph(std::wstring the_text) {
std::wstringstream ss(the_text);
std::wstring word;
while (std::getline(ss, word, L' ')) {
if (word.size()) {
output.push_back(text(word + L' '));
}
output.push_back(text(word + L' '));
}
return output;
}

View File

@@ -39,8 +39,26 @@ class Size : public Node {
void SetBox(Box box) override {
Node::SetBox(box);
if (constraint_ == LESS_THAN)
box.x_max = std::min(box.x_min + value_ + 1, box.x_max);
if (direction_ == WIDTH) {
switch(constraint_) {
case LESS_THAN:
case EQUAL:
box.x_max = std::min(box.x_min + value_ + 1, box.x_max);
break;
case GREATER_THAN:
break;
}
} else {
switch(constraint_) {
case LESS_THAN:
case EQUAL:
box.y_max = std::min(box.y_min + value_ + 1, box.y_max);
break;
case GREATER_THAN:
break;
}
}
children[0]->SetBox(box);
}