mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
PaintBrush: Make the line, rectangle and ellipsis preview work again
You can now see what you're drawing before committing to it. This works by passing the second_paint_event from the ImageEditor to the tool. We also pass the active layer which makes it easier for the tool to keep his logic in layer-relative coordinates even while drawing preview states directly into the ImageEditor backing bitmap.
This commit is contained in:
parent
8318842c7e
commit
96d03546ef
Notes:
sideshowbarker
2024-07-19 06:40:51 +09:00
Author: https://github.com/awesomekling
Commit: 96d03546ef
9 changed files with 20 additions and 17 deletions
|
@ -96,18 +96,15 @@ void LineTool::on_mousemove(Layer&, GUI::MouseEvent& event, GUI::MouseEvent&)
|
|||
m_editor->update();
|
||||
}
|
||||
|
||||
void LineTool::on_second_paint(GUI::PaintEvent& event)
|
||||
void LineTool::on_second_paint(const Layer& layer, GUI::PaintEvent& event)
|
||||
{
|
||||
if (m_drawing_button == GUI::MouseButton::None)
|
||||
return;
|
||||
|
||||
(void)event;
|
||||
|
||||
#if 0
|
||||
GUI::Painter painter(*m_widget);
|
||||
GUI::Painter painter(*m_editor);
|
||||
painter.add_clip_rect(event.rect());
|
||||
painter.translate(layer.location());
|
||||
painter.draw_line(m_line_start_position, m_line_end_position, m_editor->color_for(m_drawing_button), m_thickness);
|
||||
#endif
|
||||
}
|
||||
|
||||
void LineTool::on_keydown(GUI::KeyEvent& event)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue