1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 10:07:43 +00:00

PixelPaint: Allow reordering layer by dragging them in LayerListWidget

This is rather cool! :^)
This commit is contained in:
Andreas Kling 2020-05-25 23:48:09 +02:00
parent dc3de47b03
commit e4b11a23b7
6 changed files with 169 additions and 16 deletions

View file

@ -52,17 +52,31 @@ private:
virtual void image_did_add_layer(size_t) override;
virtual void image_did_remove_layer(size_t) override;
virtual void image_did_modify_layer(size_t);
virtual void image_did_modify_layer(size_t) override;
virtual void image_did_modify_layer_stack() override;
void rebuild_gadgets();
void relayout_gadgets();
size_t hole_index_during_move() const;
struct Gadget {
size_t layer_index { 0 };
Gfx::Rect rect;
Gfx::Rect temporary_rect_during_move;
bool is_moving { false };
Gfx::Point movement_delta;
};
bool is_moving_gadget() const { return m_moving_gadget_index.has_value(); }
Optional<size_t> gadget_at(const Gfx::Point&);
Vector<Gadget> m_gadgets;
RefPtr<Image> m_image;
Optional<size_t> m_moving_gadget_index;
Gfx::Point m_moving_event_origin;
};
}