1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +00:00

PixelPaint: Make the LineTool previews work while zoomed in

This commit is contained in:
Andreas Kling 2020-05-22 14:45:14 +02:00
parent 53b859c5ad
commit f57df29724
4 changed files with 31 additions and 15 deletions

View file

@ -65,6 +65,11 @@ void ImageEditor::paint_event(GUI::PaintEvent& event)
}
}
Gfx::FloatRect ImageEditor::layer_rect_to_editor_rect(const Layer& layer, const Gfx::Rect& layer_rect) const
{
return image_rect_to_editor_rect(layer_rect.translated(layer.location()));
}
Gfx::FloatRect ImageEditor::image_rect_to_editor_rect(const Gfx::Rect& image_rect) const
{
Gfx::FloatRect editor_rect;
@ -83,6 +88,11 @@ Gfx::FloatRect ImageEditor::editor_rect_to_image_rect(const Gfx::Rect& editor_re
return image_rect;
}
Gfx::FloatPoint ImageEditor::layer_position_to_editor_position(const Layer& layer, const Gfx::Point& layer_position) const
{
return image_position_to_editor_position(layer_position.translated(layer.location()));
}
Gfx::FloatPoint ImageEditor::image_position_to_editor_position(const Gfx::Point& image_position) const
{
Gfx::FloatPoint editor_position;