mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-04 08:46:09 +00:00
Fix wrapPositionOnTiledMode to avoid having any edge of the point shape area outside of the canvas.
When some of the edges of the point shape area is outside of the canvas the collapseRegionByTiledMode doesn't include the rects that were outside of the canvas.
This commit is contained in:
parent
8b6aa2945f
commit
34250a145f
@ -830,16 +830,28 @@ private:
|
||||
|
||||
void wrapPositionOnTiledMode(const tools::Stroke::Pt& pt, tools::Stroke::Pt& result) {
|
||||
result = pt;
|
||||
if (getTiledMode() == TiledMode::NONE)
|
||||
return;
|
||||
|
||||
if (int(getTiledMode()) & int(TiledMode::X_AXIS)) {
|
||||
result.x %= m_editor->canvasSize().w;
|
||||
if (result.x < 0)
|
||||
result.x += m_editor->canvasSize().w;
|
||||
}
|
||||
if (int(getTiledMode()) & int(TiledMode::Y_AXIS)) {
|
||||
result.y %= m_editor->canvasSize().h;
|
||||
if (result.y < 0)
|
||||
result.y += m_editor->canvasSize().h;
|
||||
}
|
||||
|
||||
gfx::Rect r;
|
||||
getPointShape()->getModifiedArea(this, result.x, result.y, r);
|
||||
|
||||
if (r.x < 0)
|
||||
result.x += m_sprite->width();
|
||||
else if (r.x2() > m_editor->canvasSize().w)
|
||||
result.x -= m_sprite->width();
|
||||
|
||||
if (r.y < 0)
|
||||
result.y += m_sprite->height();
|
||||
else if (r.y2() > m_editor->canvasSize().h)
|
||||
result.y -= m_sprite->height();
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user