mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:27:45 +00:00
PixelPaint: Account for rulers on Tool second paint events
This change makes ImageEditor provide an altered PaintEvent to the active tool when rulers are visible. This PaintEvent has a rect that has been adjust to account for the thickness of the rulers. Tools use this rect for Painter clipping and this prevents a Tool's on_second_paint from drawing over top of the rulers
This commit is contained in:
parent
a321df12e1
commit
159f6cf0ac
1 changed files with 12 additions and 2 deletions
|
@ -280,8 +280,18 @@ Gfx::IntRect ImageEditor::mouse_indicator_rect_y() const
|
||||||
|
|
||||||
void ImageEditor::second_paint_event(GUI::PaintEvent& event)
|
void ImageEditor::second_paint_event(GUI::PaintEvent& event)
|
||||||
{
|
{
|
||||||
if (m_active_tool)
|
if (m_active_tool) {
|
||||||
m_active_tool->on_second_paint(m_active_layer, event);
|
if (m_show_rulers) {
|
||||||
|
auto clipped_event = GUI::PaintEvent(Gfx::IntRect { event.rect().x() + m_ruler_thickness,
|
||||||
|
event.rect().y() + m_ruler_thickness,
|
||||||
|
event.rect().width() - m_ruler_thickness,
|
||||||
|
event.rect().height() - m_ruler_thickness },
|
||||||
|
event.window_size());
|
||||||
|
m_active_tool->on_second_paint(m_active_layer, clipped_event);
|
||||||
|
} else {
|
||||||
|
m_active_tool->on_second_paint(m_active_layer, event);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GUI::MouseEvent ImageEditor::event_with_pan_and_scale_applied(GUI::MouseEvent const& event) const
|
GUI::MouseEvent ImageEditor::event_with_pan_and_scale_applied(GUI::MouseEvent const& event) const
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue