mirror of
https://github.com/aseprite/aseprite.git
synced 2024-12-28 15:20:15 +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
|
||||
// Copyright (C) 2019-2022 Igara Studio S.A.
|
||||
// Copyright (C) 2019-2024 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -207,6 +207,7 @@ namespace app {
|
||||
virtual const doc::Grid& getGrid() const = 0;
|
||||
virtual gfx::Rect getGridBounds() = 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
|
||||
// mouse (e.g. a filled rectangle, etc.)
|
||||
|
@ -154,9 +154,8 @@ bool ToolLoopManager::releaseButton(const Pointer& pointer)
|
||||
|
||||
if (m_toolLoop->getController()->isOnePoint() &&
|
||||
m_toolLoop->getInk()->isSelection() &&
|
||||
!m_toolLoop->getSrcImage()->bounds().contains(pointer.point())) {
|
||||
!m_toolLoop->isPointInsideCanvas(pointer.point()))
|
||||
return false;
|
||||
}
|
||||
|
||||
Stroke::Pt spritePoint = getSpriteStrokePt(pointer);
|
||||
bool res = m_toolLoop->getController()->releaseButton(m_stroke, spritePoint);
|
||||
@ -209,7 +208,7 @@ void ToolLoopManager::movement(Pointer pointer)
|
||||
doLoopStep(false);
|
||||
}
|
||||
|
||||
void ToolLoopManager::disableMouseStabilizer()
|
||||
void ToolLoopManager::disableMouseStabilizer()
|
||||
{
|
||||
// Disable mouse stabilizer for the current ToolLoopManager
|
||||
m_dynamics.stabilizer = false;
|
||||
|
@ -360,6 +360,15 @@ public:
|
||||
== 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; }
|
||||
gfx::Rect getGridBounds() override { return m_gridBounds; }
|
||||
gfx::Point getCelOrigin() override { return m_celOrigin; }
|
||||
|
Loading…
Reference in New Issue
Block a user