mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-29 03:32:48 +00:00
Fix Magic Wand doesn't work correctly in Tiled Mode (fix #4659)
This commit is contained in:
parent
77e0944baa
commit
f7a9f44cec
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019-2022 Igara Studio S.A.
|
// Copyright (C) 2019-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2017 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -207,6 +207,7 @@ namespace app {
|
|||||||
virtual const doc::Grid& getGrid() const = 0;
|
virtual const doc::Grid& getGrid() const = 0;
|
||||||
virtual gfx::Rect getGridBounds() = 0;
|
virtual gfx::Rect getGridBounds() = 0;
|
||||||
virtual bool isPixelConnectivityEightConnected() = 0;
|
virtual bool isPixelConnectivityEightConnected() = 0;
|
||||||
|
virtual bool isPointInsideCanvas(const gfx::Point& point) = 0;
|
||||||
|
|
||||||
// Returns true if the figure must be filled when we release the
|
// Returns true if the figure must be filled when we release the
|
||||||
// mouse (e.g. a filled rectangle, etc.)
|
// mouse (e.g. a filled rectangle, etc.)
|
||||||
|
@ -154,9 +154,8 @@ bool ToolLoopManager::releaseButton(const Pointer& pointer)
|
|||||||
|
|
||||||
if (m_toolLoop->getController()->isOnePoint() &&
|
if (m_toolLoop->getController()->isOnePoint() &&
|
||||||
m_toolLoop->getInk()->isSelection() &&
|
m_toolLoop->getInk()->isSelection() &&
|
||||||
!m_toolLoop->getSrcImage()->bounds().contains(pointer.point())) {
|
!m_toolLoop->isPointInsideCanvas(pointer.point()))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
Stroke::Pt spritePoint = getSpriteStrokePt(pointer);
|
Stroke::Pt spritePoint = getSpriteStrokePt(pointer);
|
||||||
bool res = m_toolLoop->getController()->releaseButton(m_stroke, spritePoint);
|
bool res = m_toolLoop->getController()->releaseButton(m_stroke, spritePoint);
|
||||||
|
@ -360,6 +360,15 @@ public:
|
|||||||
== app::gen::PixelConnectivity::EIGHT_CONNECTED);
|
== app::gen::PixelConnectivity::EIGHT_CONNECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isPointInsideCanvas(const gfx::Point& point) override {
|
||||||
|
const int a = ((getTiledMode() == TiledMode::X_AXIS ||
|
||||||
|
getTiledMode() == TiledMode::BOTH) ? 3 : 1);
|
||||||
|
const int b = ((getTiledMode() == TiledMode::Y_AXIS ||
|
||||||
|
getTiledMode() == TiledMode::BOTH) ? 3 : 1);
|
||||||
|
return 0 <= point.x && point.x < a * sprite()->size().w &&
|
||||||
|
0 <= point.y && point.y < b * sprite()->size().h;
|
||||||
|
}
|
||||||
|
|
||||||
const doc::Grid& getGrid() const override { return m_grid; }
|
const doc::Grid& getGrid() const override { return m_grid; }
|
||||||
gfx::Rect getGridBounds() override { return m_gridBounds; }
|
gfx::Rect getGridBounds() override { return m_gridBounds; }
|
||||||
gfx::Point getCelOrigin() override { return m_celOrigin; }
|
gfx::Point getCelOrigin() override { return m_celOrigin; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user