mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 19:57:45 +03:00
PixelPaint: Make brush draw on mousedown
This makes the brush tool start drawing a point before the user moves the mouse, like in Photoshop and Gimp. The number of iterations of draw_point makes for roughly 4 clicks to full opacity.
This commit is contained in:
parent
9be08e33ea
commit
618bb2d33e
Notes:
sideshowbarker
2024-07-18 10:03:25 +09:00
Author: https://github.com/metmo Commit: https://github.com/SerenityOS/serenity/commit/618bb2d33e8 Pull-request: https://github.com/SerenityOS/serenity/pull/8503 Reviewed-by: https://github.com/awesomekling
@ -25,11 +25,17 @@ BrushTool::~BrushTool()
|
||||
{
|
||||
}
|
||||
|
||||
void BrushTool::on_mousedown(Layer&, GUI::MouseEvent& event, GUI::MouseEvent&)
|
||||
void BrushTool::on_mousedown(Layer& layer, GUI::MouseEvent& event, GUI::MouseEvent&)
|
||||
{
|
||||
if (event.button() != GUI::MouseButton::Left && event.button() != GUI::MouseButton::Right)
|
||||
return;
|
||||
|
||||
const int first_draw_opacity = 10;
|
||||
|
||||
for (int i = 0; i < first_draw_opacity; ++i)
|
||||
draw_point(layer.bitmap(), m_editor->color_for(event), event.position());
|
||||
|
||||
layer.did_modify_bitmap();
|
||||
m_last_position = event.position();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user