Show brush preview for custom brushes when using Paint Bucket tool (fix #4052)

This commit is contained in:
Martín Capello 2023-09-22 15:39:12 -03:00 committed by David Capello
parent 6c06a48456
commit 8b747b4d09
3 changed files with 13 additions and 7 deletions

View File

@ -1152,8 +1152,8 @@ public:
}
// Case: during brush preview of PaintBucket Tool
else if (loop->getController()->isOnePoint()) {
m_u = m_brush->bounds().w / 2;
m_v = m_brush->bounds().h / 2;
m_u = 0;
m_v = 0;
}
else {
m_u = ((m_brush->patternOrigin().x % loop->sprite()->width()) - loop->getCelOrigin().x) % m_width;

View File

@ -166,8 +166,9 @@ void BrushPreview::show(const gfx::Point& screenPos)
const bool isFloodfill = m_editor->getCurrentEditorTool()->getPointShape(0)->isFloodFill();
// TODO add support for "tile-brushes"
gfx::Rect origBrushBounds =
(isFloodfill || site.tilemapMode() == TilemapMode::Tiles ? gfx::Rect(0, 0, 1, 1):
brush->bounds());
((isFloodfill && brush->type() != BrushType::kImageBrushType) ||
site.tilemapMode() == TilemapMode::Tiles ? gfx::Rect(0, 0, 1, 1)
: brush->bounds());
gfx::Rect brushBounds = origBrushBounds;
// Cursor in the screen (view)

View File

@ -973,9 +973,14 @@ public:
tools::WellKnownPointShapes::Brush);
}
else if (m_pointShape->isFloodFill()) {
m_pointShape = App::instance()->toolBox()->getPointShapeById
(m_tilesMode ? tools::WellKnownPointShapes::Tile:
tools::WellKnownPointShapes::Pixel);
const char* id;
if (m_tilesMode)
id = tools::WellKnownPointShapes::Tile;
else if (m_brush->type() == BrushType::kImageBrushType)
id = tools::WellKnownPointShapes::Brush;
else
id = tools::WellKnownPointShapes::Pixel;
m_pointShape = App::instance()->toolBox()->getPointShapeById(id);
}
}