mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-12 03:39:51 +00:00
Fix bug using brush size on selection+snap to grid
Discussion: https://community.aseprite.org/t/snap-to-grid-problem/292
This commit is contained in:
parent
913a32fbab
commit
e372967cde
@ -1879,11 +1879,22 @@ void ContextBar::setActiveBrush(const doc::BrushRef& brush)
|
||||
updateForActiveTool();
|
||||
}
|
||||
|
||||
doc::BrushRef ContextBar::activeBrush(tools::Tool* tool) const
|
||||
doc::BrushRef ContextBar::activeBrush(tools::Tool* tool,
|
||||
tools::Ink* ink) const
|
||||
{
|
||||
if ((!tool) ||
|
||||
if (ink == nullptr)
|
||||
ink = (tool ? tool->getInk(0): nullptr);
|
||||
|
||||
// Selection tools use a brush with size = 1 (always)
|
||||
if (ink && ink->isSelection()) {
|
||||
doc::BrushRef brush;
|
||||
brush.reset(new Brush(kCircleBrushType, 1, 0));
|
||||
return brush;
|
||||
}
|
||||
|
||||
if ((tool == nullptr) ||
|
||||
(tool == App::instance()->activeTool()) ||
|
||||
(tool->getInk(0)->isPaint() &&
|
||||
(ink && ink->isPaint() &&
|
||||
m_activeBrush->type() == kImageBrushType)) {
|
||||
m_activeBrush->setPattern(Preferences::instance().brush.pattern());
|
||||
return m_activeBrush;
|
||||
|
@ -31,10 +31,6 @@ namespace render {
|
||||
class DitheringMatrix;
|
||||
}
|
||||
|
||||
namespace tools {
|
||||
class Tool;
|
||||
}
|
||||
|
||||
namespace ui {
|
||||
class Box;
|
||||
class Button;
|
||||
@ -44,6 +40,11 @@ namespace ui {
|
||||
|
||||
namespace app {
|
||||
|
||||
namespace tools {
|
||||
class Ink;
|
||||
class Tool;
|
||||
}
|
||||
|
||||
class BrushSlot;
|
||||
class DitheringSelector;
|
||||
|
||||
@ -58,13 +59,14 @@ namespace app {
|
||||
void updateForTool(tools::Tool* tool);
|
||||
void updateForMovingPixels();
|
||||
void updateForSelectingBox(const std::string& text);
|
||||
void updateToolLoopModifiersIndicators(app::tools::ToolLoopModifiers modifiers);
|
||||
void updateToolLoopModifiersIndicators(tools::ToolLoopModifiers modifiers);
|
||||
void updateAutoSelectLayer(bool state);
|
||||
bool isAutoSelectLayer() const;
|
||||
|
||||
void setActiveBrush(const doc::BrushRef& brush);
|
||||
void setActiveBrushBySlot(tools::Tool* tool, int slot);
|
||||
doc::BrushRef activeBrush(tools::Tool* tool = nullptr) const;
|
||||
doc::BrushRef activeBrush(tools::Tool* tool = nullptr,
|
||||
tools::Ink* ink = nullptr) const;
|
||||
void discardActiveBrush();
|
||||
|
||||
BrushSlot createBrushSlotFromPreferences();
|
||||
|
@ -104,7 +104,7 @@ public:
|
||||
const app::Color& bgColor)
|
||||
: m_editor(editor)
|
||||
, m_tool(tool)
|
||||
, m_brush(App::instance()->contextBar()->activeBrush(m_tool))
|
||||
, m_brush(App::instance()->contextBar()->activeBrush(m_tool, ink))
|
||||
, m_document(document)
|
||||
, m_sprite(editor->sprite())
|
||||
, m_layer(layer)
|
||||
|
Loading…
x
Reference in New Issue
Block a user