mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +00:00
PixelPaint: Draw layers from the top of LayerList
As pointed out by Andreas, drawing them from the bottom feels odd since no other list in the UI is bottom-justified. The commit draws the layers from the top of the list again.
This commit is contained in:
parent
449cbd5ecc
commit
3dccafb2a0
2 changed files with 5 additions and 9 deletions
|
@ -277,9 +277,7 @@ size_t LayerListWidget::hole_index_during_move() const
|
||||||
VERIFY(is_moving_gadget());
|
VERIFY(is_moving_gadget());
|
||||||
auto& moving_gadget = m_gadgets[m_moving_gadget_index.value()];
|
auto& moving_gadget = m_gadgets[m_moving_gadget_index.value()];
|
||||||
int center_y_of_moving_gadget = moving_gadget.rect.translated(0, moving_gadget.movement_delta.y()).center().y();
|
int center_y_of_moving_gadget = moving_gadget.rect.translated(0, moving_gadget.movement_delta.y()).center().y();
|
||||||
|
return center_y_of_moving_gadget / vertical_step;
|
||||||
int top_of_gadgets = max(0, height() - m_total_gadget_height);
|
|
||||||
return (center_y_of_moving_gadget - top_of_gadgets) / vertical_step;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerListWidget::select_bottom_layer()
|
void LayerListWidget::select_bottom_layer()
|
||||||
|
@ -318,9 +316,7 @@ void LayerListWidget::cycle_through_selection(int delta)
|
||||||
|
|
||||||
void LayerListWidget::relayout_gadgets()
|
void LayerListWidget::relayout_gadgets()
|
||||||
{
|
{
|
||||||
m_total_gadget_height = static_cast<int>(m_gadgets.size()) * vertical_step + 6;
|
int y = 0;
|
||||||
int y = max(0, height() - m_total_gadget_height);
|
|
||||||
|
|
||||||
Optional<size_t> hole_index;
|
Optional<size_t> hole_index;
|
||||||
if (is_moving_gadget())
|
if (is_moving_gadget())
|
||||||
hole_index = hole_index_during_move();
|
hole_index = hole_index_during_move();
|
||||||
|
@ -336,8 +332,9 @@ void LayerListWidget::relayout_gadgets()
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_content_size({ widget_inner_rect().width(), m_total_gadget_height });
|
auto total_gadget_height = static_cast<int>(m_gadgets.size()) * vertical_step + 6;
|
||||||
vertical_scrollbar().set_range(0, max(m_total_gadget_height - height(), 0));
|
set_content_size({ widget_inner_rect().width(), total_gadget_height });
|
||||||
|
vertical_scrollbar().set_range(0, max(total_gadget_height - height(), 0));
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,6 @@ private:
|
||||||
Gfx::IntPoint m_moving_event_origin;
|
Gfx::IntPoint m_moving_event_origin;
|
||||||
|
|
||||||
size_t m_selected_gadget_index { 0 };
|
size_t m_selected_gadget_index { 0 };
|
||||||
int m_total_gadget_height { 0 };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue