Ensure child items have their measure_item() called so they can perform layout, if necessary

This commit is contained in:
Michael Davidson 2023-12-29 18:38:37 +11:00
parent 9b658980b2
commit 6e51b4f479
No known key found for this signature in database
GPG key ID: B8D1A99712B8B0EB

View file

@ -12,6 +12,7 @@ static const char *const TAG = "fixeddimensionpanel";
void FixedDimensionPanel::dump_config(int indent_depth, int additional_level_depth) { void FixedDimensionPanel::dump_config(int indent_depth, int additional_level_depth) {
ESP_LOGCONFIG(TAG, "%*sWidth: %i (Will use display width: %s)", indent_depth, "", this->width_.value(), YESNO(this->width_.value() < 1)); ESP_LOGCONFIG(TAG, "%*sWidth: %i (Will use display width: %s)", indent_depth, "", this->width_.value(), YESNO(this->width_.value() < 1));
ESP_LOGCONFIG(TAG, "%*sHeight: %i (Will use display height: %s)", indent_depth, "", this->height_.value(), YESNO(this->height_.value() < 1)); ESP_LOGCONFIG(TAG, "%*sHeight: %i (Will use display height: %s)", indent_depth, "", this->height_.value(), YESNO(this->height_.value() < 1));
ESP_LOGCONFIG(TAG, "%*sHas Child: %s", indent_depth, "", YESNO(this->child_ != nullptr));
this->child_->dump_config(indent_depth + additional_level_depth, additional_level_depth); this->child_->dump_config(indent_depth + additional_level_depth, additional_level_depth);
} }
@ -23,6 +24,9 @@ display::Rect FixedDimensionPanel::measure_item_internal(display::Display *displ
if (rect.h < 1) { if (rect.h < 1) {
rect.h = display->get_height(); rect.h = display->get_height();
} }
// Call measure_child just so they can do any measurements
this->child_->measure_item(display);
return rect; return rect;
} }