mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:47:45 +00:00
PixelPaint: Allow move tool to scale in all directions
It is now possible to scale the current layer using the move tool from all four corners of the layer boundary. Previously scaling was only possible from the bottom right of the image.
This commit is contained in:
parent
85bfeba8c6
commit
a30b956e94
2 changed files with 80 additions and 35 deletions
|
@ -12,6 +12,12 @@
|
|||
|
||||
namespace PixelPaint {
|
||||
|
||||
enum class ResizeAnchorLocation {
|
||||
BottomLeft,
|
||||
BottomRight,
|
||||
TopLeft,
|
||||
TopRight
|
||||
};
|
||||
class MoveTool final : public Tool {
|
||||
public:
|
||||
MoveTool() = default;
|
||||
|
@ -28,14 +34,14 @@ public:
|
|||
private:
|
||||
virtual StringView tool_name() const override { return "Move Tool"sv; }
|
||||
ErrorOr<void> update_cached_preview_bitmap(Layer const* layer);
|
||||
Optional<ResizeAnchorLocation const> resize_anchor_location_from_cursor_position(Layer const*, MouseEvent&);
|
||||
|
||||
RefPtr<Layer> m_layer_being_moved;
|
||||
Gfx::IntPoint m_event_origin;
|
||||
Gfx::IntPoint m_layer_origin;
|
||||
Gfx::IntPoint m_new_scaled_layer_location;
|
||||
Gfx::IntSize m_new_layer_size;
|
||||
Gfx::IntRect m_new_layer_rect;
|
||||
bool m_scaling { false };
|
||||
bool m_mouse_in_resize_corner { false };
|
||||
Optional<ResizeAnchorLocation const> m_resize_anchor_location {};
|
||||
bool m_keep_ascept_ratio { false };
|
||||
|
||||
RefPtr<Gfx::Bitmap> m_cached_preview_bitmap { nullptr };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue