From 0c56f06994f48f3e54c38736feb3fe0a964f42c1 Mon Sep 17 00:00:00 2001 From: Mustafa Quraish Date: Thu, 2 Sep 2021 05:09:30 -0400 Subject: [PATCH] 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. --- Userland/Applications/PixelPaint/LayerListWidget.cpp | 4 ++-- 1 file 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(m_gadgets.size()) * vertical_step + 6; + int y = max(0, height() - total_gadget_height); Optional hole_index; if (is_moving_gadget()) @@ -333,7 +334,6 @@ void LayerListWidget::relayout_gadgets() ++index; } - auto total_gadget_height = static_cast(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();