mirror of
https://github.com/aseprite/aseprite.git
synced 2024-10-06 06:50:07 +00:00
Fix slice tool doesn't work correctly in a tilemap layer when we are in Manual mode (fix #4290)
This commit is contained in:
parent
7b9594f4e0
commit
9e2728992d
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2022 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// 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
|
// For selection inks we don't use a "the selected layer" for
|
||||||
// preview purposes, because we want the selection feedback to be at
|
// preview purposes, because we want the selection feedback to be at
|
||||||
// the top of all layers.
|
// the top of all layers.
|
||||||
Layer* previewLayer = (m_toolLoop->getInk()->isSelection() ? nullptr:
|
Layer* previewLayer = (m_toolLoop->getInk()->isSelection() ||
|
||||||
m_toolLoop->getLayer());
|
m_toolLoop->getInk()->isSlice() ?
|
||||||
|
nullptr : m_toolLoop->getLayer());
|
||||||
|
|
||||||
// Prepare preview image (the destination image will be our preview
|
// Prepare preview image (the destination image will be our preview
|
||||||
// in the tool-loop time, so we can see what we are drawing)
|
// in the tool-loop time, so we can see what we are drawing)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019-2023 Igara Studio S.A.
|
// Copyright (C) 2019-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// 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(
|
m_expandCelCanvas.reset(new ExpandCelCanvas(
|
||||||
site, m_layer,
|
site, m_layer,
|
||||||
m_docPref.tiled.mode(),
|
m_docPref.tiled.mode(),
|
||||||
@ -530,10 +533,10 @@ public:
|
|||||||
(m_layer->isTilemap() &&
|
(m_layer->isTilemap() &&
|
||||||
site.tilemapMode() == TilemapMode::Pixels &&
|
site.tilemapMode() == TilemapMode::Pixels &&
|
||||||
site.tilesetMode() == TilesetMode::Manual &&
|
site.tilesetMode() == TilesetMode::Manual &&
|
||||||
!m_ink->isSelection() ? ExpandCelCanvas::TilesetPreview:
|
(!isSelectionPreview ? ExpandCelCanvas::TilesetPreview:
|
||||||
ExpandCelCanvas::None) |
|
ExpandCelCanvas::None)) |
|
||||||
(m_ink->isSelection() ? ExpandCelCanvas::SelectionPreview:
|
(isSelectionPreview ? ExpandCelCanvas::SelectionPreview:
|
||||||
ExpandCelCanvas::None))));
|
ExpandCelCanvas::None))));
|
||||||
|
|
||||||
if (!m_floodfillSrcImage)
|
if (!m_floodfillSrcImage)
|
||||||
m_floodfillSrcImage = const_cast<Image*>(getSrcImage());
|
m_floodfillSrcImage = const_cast<Image*>(getSrcImage());
|
||||||
@ -555,7 +558,7 @@ public:
|
|||||||
m_sprayWidth = m_toolPref.spray.width();
|
m_sprayWidth = m_toolPref.spray.width();
|
||||||
m_spraySpeed = m_toolPref.spray.speed();
|
m_spraySpeed = m_toolPref.spray.speed();
|
||||||
|
|
||||||
if (m_ink->isSelection()) {
|
if (isSelectionPreview) {
|
||||||
m_useMask = false;
|
m_useMask = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -563,7 +566,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Start with an empty mask if the user is selecting with "default selection mode"
|
// Start with an empty mask if the user is selecting with "default selection mode"
|
||||||
if (m_ink->isSelection() &&
|
if (isSelectionPreview &&
|
||||||
(!m_document->isMaskVisible() ||
|
(!m_document->isMaskVisible() ||
|
||||||
(int(getModifiers()) & int(tools::ToolLoopModifiers::kReplaceSelection)))) {
|
(int(getModifiers()) & int(tools::ToolLoopModifiers::kReplaceSelection)))) {
|
||||||
Mask emptyMask;
|
Mask emptyMask;
|
||||||
|
Loading…
Reference in New Issue
Block a user