Fix slice tool doesn't work correctly in a tilemap layer when we are in Manual mode (fix #4290)

This commit is contained in:
Gaspar Capello 2024-02-08 12:42:38 -03:00 committed by David Capello
parent 7b9594f4e0
commit 9e2728992d
2 changed files with 14 additions and 10 deletions

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2018-2024 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -96,8 +96,9 @@ void DrawingState::initToolLoop(Editor* editor,
// For selection inks we don't use a "the selected layer" for
// preview purposes, because we want the selection feedback to be at
// the top of all layers.
Layer* previewLayer = (m_toolLoop->getInk()->isSelection() ? nullptr:
m_toolLoop->getLayer());
Layer* previewLayer = (m_toolLoop->getInk()->isSelection() ||
m_toolLoop->getInk()->isSlice() ?
nullptr : m_toolLoop->getLayer());
// Prepare preview image (the destination image will be our preview
// in the tool-loop time, so we can see what we are drawing)

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019-2023 Igara Studio S.A.
// Copyright (C) 2019-2024 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -517,6 +517,9 @@ public:
}
}
// 'isSelectionPreview = true' if the intention is to show a preview
// of Selection tools or Slice tool.
const bool isSelectionPreview = m_ink->isSelection() || m_ink->isSlice();
m_expandCelCanvas.reset(new ExpandCelCanvas(
site, m_layer,
m_docPref.tiled.mode(),
@ -530,9 +533,9 @@ public:
(m_layer->isTilemap() &&
site.tilemapMode() == TilemapMode::Pixels &&
site.tilesetMode() == TilesetMode::Manual &&
!m_ink->isSelection() ? ExpandCelCanvas::TilesetPreview:
ExpandCelCanvas::None) |
(m_ink->isSelection() ? ExpandCelCanvas::SelectionPreview:
(!isSelectionPreview ? ExpandCelCanvas::TilesetPreview:
ExpandCelCanvas::None)) |
(isSelectionPreview ? ExpandCelCanvas::SelectionPreview:
ExpandCelCanvas::None))));
if (!m_floodfillSrcImage)
@ -555,7 +558,7 @@ public:
m_sprayWidth = m_toolPref.spray.width();
m_spraySpeed = m_toolPref.spray.speed();
if (m_ink->isSelection()) {
if (isSelectionPreview) {
m_useMask = false;
}
else {
@ -563,7 +566,7 @@ public:
}
// Start with an empty mask if the user is selecting with "default selection mode"
if (m_ink->isSelection() &&
if (isSelectionPreview &&
(!m_document->isMaskVisible() ||
(int(getModifiers()) & int(tools::ToolLoopModifiers::kReplaceSelection)))) {
Mask emptyMask;