1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:07:34 +00:00

PixelPaint: Let the move tool optionally select the active layer

Previously, the move tool would always select the topmost layer before
performing a move operation. This commit adds an option for the move
tool to always select the active layer, even if it is behind another.
This commit is contained in:
Tim Ledbetter 2023-01-15 21:22:30 +00:00 committed by Jelle Raaijmakers
parent 16eca649f1
commit 77e15ff4da
3 changed files with 66 additions and 5 deletions

View file

@ -372,10 +372,9 @@ void ImageEditor::mousedown_event(GUI::MouseEvent& event)
if (!m_active_tool)
return;
if (is<MoveTool>(*m_active_tool)) {
if (auto* other_layer = layer_at_editor_position(event.position())) {
set_active_layer(other_layer);
}
if (auto* tool = dynamic_cast<MoveTool*>(m_active_tool); tool && tool->layer_selection_mode() == MoveTool::LayerSelectionMode::ForegroundLayer) {
if (auto* foreground_layer = layer_at_editor_position(event.position()))
set_active_layer(foreground_layer);
}
auto layer_event = m_active_layer ? event_adjusted_for_layer(event, *m_active_layer) : event;