mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:27:35 +00:00
PixelPaint: Fix tool preview positions after moving a layer
Previously the tool previews did not account for the position of the layer, so would be drawn in the wrong location if the layer was not at 0,0.
This commit is contained in:
parent
973771f8f4
commit
78813313f9
5 changed files with 11 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "Tool.h"
|
||||
#include "../ImageEditor.h"
|
||||
#include "../Layer.h"
|
||||
#include <LibGUI/Action.h>
|
||||
|
||||
namespace PixelPaint {
|
||||
|
@ -46,6 +47,11 @@ void Tool::on_keydown(GUI::KeyEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
Gfx::IntPoint Tool::editor_layer_location(Layer const& layer) const
|
||||
{
|
||||
return (Gfx::FloatPoint { layer.location() } * m_editor->scale()).to_rounded<int>();
|
||||
}
|
||||
|
||||
Gfx::IntPoint Tool::editor_stroke_position(Gfx::IntPoint const& pixel_coords, int stroke_thickness) const
|
||||
{
|
||||
auto position = m_editor->content_to_frame_position(pixel_coords);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue