summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorMustafa Quraish <mustafaq9@gmail.com>2021-09-02 05:09:30 -0400
committerAndreas Kling <kling@serenityos.org>2021-09-03 01:49:32 +0200
commit0c56f06994f48f3e54c38736feb3fe0a964f42c1 (patch)
treefb11613dbc5145065c1f0acbdfce87e8a23be405 /Userland
parent339f0d5bcaf2c1197bdf8c376f30f106adefff4d (diff)
downloadserenity-0c56f06994f48f3e54c38736feb3fe0a964f42c1.zip
PixelPaint: Draw layers from bottom of panel, adjust spacing
If we don't have enough layers to be able to scroll, the layers are pushed to be at the top of the layer list. This doesn't make much sense now that we are correctly drawing the layers in the right order, so now we draw them justified towards the bottom. Previously we were also clipping the bottom gadget slightly when there were enough layers to scroll. Now, I'm adding some offset to the total height to account for this and give equivalent spacing from the top and bottom layers.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/PixelPaint/LayerListWidget.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Applications/PixelPaint/LayerListWidget.cpp b/Userland/Applications/PixelPaint/LayerListWidget.cpp
index a81c5a1006..3f8018d4f1 100644
--- a/Userland/Applications/PixelPaint/LayerListWidget.cpp
+++ b/Userland/Applications/PixelPaint/LayerListWidget.cpp
@@ -316,7 +316,8 @@ void LayerListWidget::cycle_through_selection(int delta)
void LayerListWidget::relayout_gadgets()
{
- int y = 0;
+ auto total_gadget_height = static_cast<int>(m_gadgets.size()) * vertical_step + 6;
+ int y = max(0, height() - total_gadget_height);
Optional<size_t> hole_index;
if (is_moving_gadget())
@@ -333,7 +334,6 @@ void LayerListWidget::relayout_gadgets()
++index;
}
- auto total_gadget_height = static_cast<int>(m_gadgets.size()) * vertical_step;
set_content_size({ widget_inner_rect().width(), total_gadget_height });
vertical_scrollbar().set_range(0, max(total_gadget_height - height(), 0));
update();