mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-17 16:38:09 +08:00
Extract common struct Dimensions from Terminal (#171)
- Convert Dimension to namespace to allow defining Fit method from dom. - Use Dimensions extracted from Terminal as replacement struct. - Convert Terminal to namespace as it only defines static members. - Remove dom references from screen library (circular dependency).
This commit is contained in:

committed by
GitHub

parent
34d955e9ac
commit
49e8cc57d3
@@ -59,6 +59,16 @@ Element operator|(Element element, Decorator decorator) {
|
||||
return decorator(std::move(element));
|
||||
}
|
||||
|
||||
/// The minimal dimension that will fit the given element.
|
||||
/// @see Fixed
|
||||
/// @see Full
|
||||
Dimensions Dimension::Fit(Element& e) {
|
||||
e->ComputeRequirement();
|
||||
Dimensions size = Dimension::Full();
|
||||
return {std::min(e->requirement().min_x, size.dimx),
|
||||
std::min(e->requirement().min_y, size.dimy)};
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
|
||||
// Copyright 2020 Arthur Sonzogni. All rights reserved.
|
||||
|
Reference in New Issue
Block a user