diff options
author | Mustafa Quraish <mustafaq9@gmail.com> | 2021-09-12 16:57:25 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-13 22:13:22 +0200 |
commit | f28b2a875a0fa6b7ee88cac1858955e64842d8a8 (patch) | |
tree | f880ab6a2119afef868ac3658684c96d5dbd27fe /Userland/Applications/PixelPaint | |
parent | 11263beaca8391ab21561c84824d5ec181a17f0a (diff) | |
download | serenity-f28b2a875a0fa6b7ee88cac1858955e64842d8a8.zip |
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.
Diffstat (limited to 'Userland/Applications/PixelPaint')
-rw-r--r-- | Userland/Applications/PixelPaint/CloneTool.cpp | 9 | ||||
-rw-r--r-- | Userland/Applications/PixelPaint/CloneTool.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Applications/PixelPaint/CloneTool.cpp b/Userland/Applications/PixelPaint/CloneTool.cpp index 6a68ca1890..fb1064e765 100644 --- a/Userland/Applications/PixelPaint/CloneTool.cpp +++ b/Userland/Applications/PixelPaint/CloneTool.cpp @@ -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; } } diff --git a/Userland/Applications/PixelPaint/CloneTool.h b/Userland/Applications/PixelPaint/CloneTool.h index 280a96e627..2c19bbbd93 100644 --- a/Userland/Applications/PixelPaint/CloneTool.h +++ b/Userland/Applications/PixelPaint/CloneTool.h @@ -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; |