mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:47:35 +00:00
PixelPaint: Update palette colors in real-time while picking
Palette color selections in `PaletteWidget` now update while interacting with `GUI::ColorPicker`
This commit is contained in:
parent
5866a3a731
commit
0388bb019f
1 changed files with 8 additions and 5 deletions
|
@ -33,13 +33,14 @@ public:
|
||||||
{
|
{
|
||||||
if (event.modifiers() & KeyModifier::Mod_Ctrl) {
|
if (event.modifiers() & KeyModifier::Mod_Ctrl) {
|
||||||
auto dialog = GUI::ColorPicker::construct(m_color, window());
|
auto dialog = GUI::ColorPicker::construct(m_color, window());
|
||||||
if (dialog->exec() == GUI::Dialog::ExecResult::OK) {
|
dialog->on_color_changed = [this](Gfx::Color color) {
|
||||||
m_color = dialog->color();
|
m_color = color;
|
||||||
auto pal = palette();
|
auto pal = palette();
|
||||||
pal.set_color(ColorRole::Background, m_color);
|
pal.set_color(ColorRole::Background, m_color);
|
||||||
set_palette(pal);
|
set_palette(pal);
|
||||||
update();
|
update();
|
||||||
}
|
};
|
||||||
|
dialog->exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.button() == GUI::MouseButton::Primary)
|
if (event.button() == GUI::MouseButton::Primary)
|
||||||
|
@ -72,8 +73,10 @@ public:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto dialog = GUI::ColorPicker::construct(m_color, window());
|
auto dialog = GUI::ColorPicker::construct(m_color, window());
|
||||||
if (dialog->exec() == GUI::Dialog::ExecResult::OK)
|
dialog->on_color_changed = [this](Gfx::Color color) {
|
||||||
on_color_change(dialog->color());
|
on_color_change(color);
|
||||||
|
};
|
||||||
|
dialog->exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_background_color(Color color)
|
void set_background_color(Color color)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue