mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:57:45 +00:00
Magnifier: Update grid color in real-time
The grid color now updates while interacting with `GUI::ColorPicker`
This commit is contained in:
parent
825c9eaeb1
commit
5866a3a731
1 changed files with 3 additions and 1 deletions
|
@ -123,10 +123,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
auto choose_grid_color_action = GUI::Action::create(
|
auto choose_grid_color_action = GUI::Action::create(
|
||||||
"Choose Grid &Color", [&](auto& action [[maybe_unused]]) {
|
"Choose Grid &Color", [&](auto& action [[maybe_unused]]) {
|
||||||
auto dialog = GUI::ColorPicker::construct(magnifier->grid_color(), window, "Magnifier: choose grid color");
|
auto dialog = GUI::ColorPicker::construct(magnifier->grid_color(), window, "Magnifier: choose grid color");
|
||||||
|
dialog->on_color_changed = [&magnifier](Gfx::Color color) {
|
||||||
|
magnifier->set_grid_color(color);
|
||||||
|
};
|
||||||
dialog->set_color_has_alpha_channel(true);
|
dialog->set_color_has_alpha_channel(true);
|
||||||
if (dialog->exec() == GUI::Dialog::ExecResult::OK) {
|
if (dialog->exec() == GUI::Dialog::ExecResult::OK) {
|
||||||
Config::write_string("Magnifier"sv, "Grid"sv, "Color"sv, dialog->color().to_deprecated_string());
|
Config::write_string("Magnifier"sv, "Grid"sv, "Color"sv, dialog->color().to_deprecated_string());
|
||||||
magnifier->set_grid_color(dialog->color());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue