1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:47:34 +00:00

PixelPaint: Scale layer and preserve aspect ratio

This patch adds the ability to scale a layer and
preserve the aspect ratio.
When the Shift key is pressed, the aspect ratio is preserved.
This commit is contained in:
Tommaso Peduzzi 2022-08-13 16:44:18 +02:00 committed by Andreas Kling
parent 293ab2cdc9
commit f547b9be7b
2 changed files with 32 additions and 6 deletions

View file

@ -21,6 +21,7 @@ public:
virtual void on_mousemove(Layer*, MouseEvent&) override;
virtual void on_mouseup(Layer*, MouseEvent&) override;
virtual void on_keydown(GUI::KeyEvent&) override;
virtual void on_keyup(GUI::KeyEvent&) override;
virtual Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>> cursor() override;
private:
@ -29,8 +30,11 @@ private:
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;
bool m_scaling { false };
bool m_mouse_in_resize_corner { false };
bool m_keep_ascept_ratio { false };
};
}