PixelPaint: Scroll into view when reordering layers

Make LayerListWidget scroll into view when reordering layers.
This commit is contained in:
Marcus Nilsson 2021-07-06 00:24:16 +02:00 committed by Andreas Kling
parent 618bb2d33e
commit 0900e31fe0
Notes: sideshowbarker 2024-07-18 10:03:21 +09:00

View file

@ -163,6 +163,11 @@ void LayerListWidget::mousemove_event(GUI::MouseEvent& event)
auto& gadget = m_gadgets[m_moving_gadget_index.value()];
VERIFY(gadget.is_moving);
gadget.movement_delta = delta;
auto adjusted_rect = gadget.rect;
adjusted_rect.translate_by(gadget.movement_delta);
scroll_into_view(adjusted_rect, false, true);
relayout_gadgets();
}