mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
PixelPaint: Make CloneTool change cursor temporarily while selecting
This just provides some nice visual feedback when you are in the middle of selecting a color. An eyedropper might not be the ideal choice here, but among the cursors we already have it is the best one.
This commit is contained in:
parent
11263beaca
commit
f28b2a875a
Notes:
sideshowbarker
2024-07-18 04:00:23 +09:00
Author: https://github.com/mustafaquraish Commit: https://github.com/SerenityOS/serenity/commit/f28b2a875a0 Pull-request: https://github.com/SerenityOS/serenity/pull/10007 Reviewed-by: https://github.com/TobyAsE ✅
2 changed files with 10 additions and 0 deletions
|
@ -52,6 +52,13 @@ void CloneTool::draw_line(Gfx::Bitmap& bitmap, Gfx::Color const& color, Gfx::Int
|
|||
BrushTool::draw_line(bitmap, color, start, end);
|
||||
}
|
||||
|
||||
Gfx::StandardCursor CloneTool::cursor()
|
||||
{
|
||||
if (m_is_selecting_location)
|
||||
return Gfx::StandardCursor::Eyedropper;
|
||||
return Gfx::StandardCursor::Crosshair;
|
||||
}
|
||||
|
||||
void CloneTool::on_mousemove(Layer* layer, MouseEvent& event)
|
||||
{
|
||||
auto& image_event = event.image_event();
|
||||
|
@ -112,6 +119,7 @@ void CloneTool::on_keydown(GUI::KeyEvent& event)
|
|||
Tool::on_keydown(event);
|
||||
if (event.key() == KeyCode::Key_Alt && !m_is_selecting_location) {
|
||||
m_is_selecting_location = true;
|
||||
m_editor->update_tool_cursor();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -120,6 +128,7 @@ void CloneTool::on_keyup(GUI::KeyEvent& event)
|
|||
{
|
||||
if (m_is_selecting_location && event.key() == KeyCode::Key_Alt) {
|
||||
m_is_selecting_location = false;
|
||||
m_editor->update_tool_cursor();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ public:
|
|||
virtual ~CloneTool() override = default;
|
||||
|
||||
virtual GUI::Widget* get_properties_widget() override;
|
||||
virtual Gfx::StandardCursor cursor() override;
|
||||
|
||||
protected:
|
||||
virtual void draw_point(Gfx::Bitmap& bitmap, Gfx::Color const& color, Gfx::IntPoint const& point) override;
|
||||
|
|
Loading…
Reference in a new issue