mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:17:44 +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
9 changed files with 20 additions and 17 deletions
|
@ -62,6 +62,12 @@ void ImageEditor::paint_event(GUI::PaintEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
void ImageEditor::second_paint_event(GUI::PaintEvent& event)
|
||||
{
|
||||
if (m_active_tool && m_active_layer)
|
||||
m_active_tool->on_second_paint(*m_active_layer, event);
|
||||
}
|
||||
|
||||
static GUI::MouseEvent event_adjusted_for_layer(const GUI::MouseEvent& original_event, const Layer& layer)
|
||||
{
|
||||
auto position_in_active_layer_coordinates = original_event.position().translated(-layer.location());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue