1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 16:18:12 +00:00

PixelPaint: Correctly offset stroke position for even thicknesses

This commit is contained in:
Gal Horowitz 2021-10-02 20:33:01 +03:00 committed by Andreas Kling
parent be4485fe85
commit cd7473d1a3

View file

@ -56,7 +56,7 @@ void Tool::on_keydown(GUI::KeyEvent& event)
Gfx::IntPoint Tool::editor_stroke_position(Gfx::IntPoint const& pixel_coords, int stroke_thickness) const
{
auto position = m_editor->image_position_to_editor_position(pixel_coords);
auto offset = (stroke_thickness % 2 == 0) ? m_editor->scale() : m_editor->scale() / 2;
auto offset = (stroke_thickness % 2 == 0) ? 0 : m_editor->scale() / 2;
position = position.translated(offset, offset);
return position.to_type<int>();
}