mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 05:37:44 +00:00
PixelPaint: Fix the displayed order of layers in LayerListWidget
Previously the background layer was shown at the top, and layers in front of it were shown below it. This was really unintuitive. This patch fixes LayerListWidget to now properly differentiate between the index of a gadget, and the index of a layer, since they are essentially mirrored. I chose not to modify the order in which layers are stored since back-to-front makes it really convenient there.
This commit is contained in:
parent
432839c2e9
commit
97cc34c034
2 changed files with 52 additions and 29 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2021, Mustafa Quraish <mustafa@cs.toronto.edu>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -62,13 +63,16 @@ private:
|
|||
|
||||
Optional<size_t> gadget_at(Gfx::IntPoint const&);
|
||||
|
||||
size_t to_layer_index(size_t gadget_index) const;
|
||||
size_t to_gadget_index(size_t layer_index) const;
|
||||
|
||||
Vector<Gadget> m_gadgets;
|
||||
RefPtr<Image> m_image;
|
||||
|
||||
Optional<size_t> m_moving_gadget_index;
|
||||
Gfx::IntPoint m_moving_event_origin;
|
||||
|
||||
size_t m_selected_layer_index { 0 };
|
||||
size_t m_selected_gadget_index { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue