You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
When I tested the latest ftxui (not release 5.0.0), I found that the performance of "Modal" has changed compared to release 5.0.0, as the "Modal" component does not clear the background color. Later, I discovered that there had been a change in the implementation of "Pixel" and "clear_under" due to the "Color Alpha Support".
I checked the source code and found that the render function of clear_under sets the background color of pixels to Color::Default (i.e. transparent). Due to changes in the implementation of dbox, "clear_under" does not truly clear the background color of pixels below the Node.
The first option, in my opinion, is to change the code to below in order to better match the "clear" of clear_under.
//In src/ftxui/dom/clear_under.cppclassClearUnder : publicNodeDecorator {
public:using NodeDecorator::NodeDecorator;
voidRender(Screen& screen) override {
for (int y = box_.y_min; y <= box_.y_max; ++y) {
for (int x = box_.x_min; x <= box_.x_max; ++x) {
auto& pixel = screen.PixelAt(x, y);
pixel = Pixel();
pixel.character = ""; // Consider the pixel written.
pixel.background_color = Color::Opaque; //Some operations to set the background color opaque
}
}
Node::Render(screen);
}
};
The other option is to provide users with a customized option to set the content and color to be filled after clear_under (including whether background_comlor is transparent).
Element clear_under(Element element, std::string fill_content, Color c) {
return std::make_shared<ClearUnder>(std::move(element), fill_content, c);
}
Thank you!
The text was updated successfully, but these errors were encountered:
Wouldn't the operation you are describing being equivalent to: x | clear_under | bgcolor(fill_content) ?
This sounds simpler to encourage composing operations instead of adding new options to this Decorator.
Thank you! You solved the problem that troubled me, I didn't thought of doing it this way. However, I think we should change the examples of the modal because I was confused when trying to run the modal examples, as the performance of the modal (clear_under and dbox) is different from before.
This library is really interesting!
Hello!
When I tested the latest ftxui (not release 5.0.0), I found that the performance of "Modal" has changed compared to release 5.0.0, as the "Modal" component does not clear the background color. Later, I discovered that there had been a change in the implementation of "Pixel" and "clear_under" due to the "Color Alpha Support".
I checked the source code and found that the render function of clear_under sets the background color of pixels to Color::Default (i.e. transparent). Due to changes in the implementation of dbox, "clear_under" does not truly clear the background color of pixels below the Node.
The first option, in my opinion, is to change the code to below in order to better match the "clear" of clear_under.
The other option is to provide users with a customized option to set the content and color to be filled after clear_under (including whether background_comlor is transparent).
Thank you!
The text was updated successfully, but these errors were encountered: