mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:47:35 +00:00
PixelPaint: ColorPicker updates user colors while dragging
Now the user can hold primary and/or secondary mouse buttons and move the mouse around while previewing the color on the statusbar and fine tune their selection. The color will update live so the color selected when mouse is released is the final color used.
This commit is contained in:
parent
29665668b6
commit
ab8522aa17
3 changed files with 22 additions and 2 deletions
|
@ -22,6 +22,24 @@ void PickerTool::on_mousedown(Layer* layer, MouseEvent& event)
|
|||
m_editor->set_editor_color_to_color_at_mouse_position(layer_event, m_sample_all_layers);
|
||||
}
|
||||
|
||||
void PickerTool::on_mouseup(Layer*, MouseEvent& event)
|
||||
{
|
||||
auto layer_event = event.layer_event();
|
||||
if (layer_event.buttons() & GUI::MouseButton::Primary || layer_event.buttons() & GUI::MouseButton::Secondary)
|
||||
return;
|
||||
m_editor->set_appended_status_info(DeprecatedString::empty());
|
||||
}
|
||||
|
||||
void PickerTool::on_mousemove(Layer* layer, MouseEvent& event)
|
||||
{
|
||||
if (!layer)
|
||||
return;
|
||||
auto layer_event = event.layer_event();
|
||||
if (!(layer_event.buttons() & GUI::MouseButton::Primary || layer_event.buttons() & GUI::MouseButton::Secondary))
|
||||
return;
|
||||
m_editor->set_editor_color_to_color_at_mouse_position(layer_event, m_sample_all_layers);
|
||||
}
|
||||
|
||||
GUI::Widget* PickerTool::get_properties_widget()
|
||||
{
|
||||
if (!m_properties_widget) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue